public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
From: 5qduh001@sneakemail.com
To: ssundaragopalan@hss.hns.com, pthreads-win32@sources.redhat.com
Subject: Re: pthread_init_mutex problem
Date: Sat, 04 May 2002 10:42:00 -0000	[thread overview]
Message-ID: <308310176.1020534165595.JavaMail.root@monkey> (raw)

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-04 17:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-04 10:42 5qduh001 [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-05-06  7:16 ssundaragopalan
2002-05-06 20:53 ` Phil Frisbie, Jr.
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=308310176.1020534165595.JavaMail.root@monkey \
    --to=5qduh001@sneakemail.com \
    --cc=pthreads-win32@sources.redhat.com \
    --cc=ssundaragopalan@hss.hns.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).