public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
From: ssundaragopalan@hss.hns.com
To: 5qduh001@sneakemail.com
Cc: pthreads-win32@sources.redhat.com
Subject: Re: pthread_init_mutex problem
Date: Mon, 06 May 2002 07:16:00 -0000	[thread overview]
Message-ID: <65256BB1.004E4265.00@sampark.hss.hns.com> (raw)



hi ppl,
       thnx for your valuble inputs. ..actually i have implmented critical
section as a solution and it works fine...the CPU utilization has come down
to 60% from 100%...

thnx & regds,
srikanth




5qduh001@sneakemail.com on 05/04/2002 02:42:43 PM

To:   Srikanth Sundaragopalan/HSSBLR, pthreads-win32@sources.redhat.com
cc:

Subject:  Re: pthread_init_mutex problem




I'd be interested in measurements comparing calling pthread_mutex_init()
vs. using PTHREAD_MUTEX_INITIALIZER.

I.e the code from the earlier e-mail:
pthread_mutex_t mutex;
assert(pthread_mutex_init(&mutex, NULL) == 0);

vs.

pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;

I haven't looked at the win32 pthread source to see what happens in either,
but I can only imagine that the latter would be more efficient if the
implementation in win32 pthreads is anything like what most other
implementations do (a linux implementation in this case), basically:

pthread_mutex_t mutex = {0, 0, 0, PTHREAD_MUTEX_FAST_NP, {0, 0}};

As I understand it, using PTHREAD_MUTEX_INITIALIZER should also allow you
to avoid the call to pthread_mutex_destroy() thus another saving.

If the PTHREAD_MUTEX_INITIALIZER is faster as I suspect, please let us know
and by roughly how much :).

Good luck,
Dave

-----------------------------------------------------
Protect yourself from spam, use http://sneakemail.com




             reply	other threads:[~2002-05-06 14:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-06  7:16 ssundaragopalan [this message]
2002-05-06 20:53 ` Phil Frisbie, Jr.
  -- strict thread matches above, loose matches on Subject: below --
2002-05-04 10:42 5qduh001
2002-05-04 10:01 Eli Ofenstein
2002-05-04  4:19 ssundaragopalan
2002-05-04  0:09 ssundaragopalan
2002-05-04 11:28 ` Phil Frisbie, Jr.

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=65256BB1.004E4265.00@sampark.hss.hns.com \
    --to=ssundaragopalan@hss.hns.com \
    --cc=5qduh001@sneakemail.com \
    --cc=pthreads-win32@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).