From: Peter Baumann <waste.manager@gmx.de>
To: Johannes Sixt <johannes.sixt@telecom.at>
Cc: git@vger.kernel.org, Nicolas Pitre <nico@cam.org>,
Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] threaded pack-objects: Use condition variables for thread communication.
Date: Sun, 16 Dec 2007 20:00:16 +0100 [thread overview]
Message-ID: <20071216190016.GC4999@xp.machine.xx> (raw)
In-Reply-To: <200712161941.38109.johannes.sixt@telecom.at>
On Sun, Dec 16, 2007 at 07:41:37PM +0100, Johannes Sixt wrote:
> On Sunday 16 December 2007 13:05, Peter Baumann wrote:
> > On Sun, Dec 16, 2007 at 12:18:53AM +0100, Johannes Sixt wrote:
> > > +
> > > + progress_lock();
> > > + me->working = 0;
> > > + progress_unlock();
> > > + pthread_cond_signal(&progress_cond);
> >
> > Shouldn't the pthread_cond_signal be inside the lock?
> > e.g. swap progress_unlock() with pthread_cond_signal(&progress_cond)
>
> No, that's not necessary. Both ways are correct, but if it's outside the lock
> there is less contention on the mutex (because the waiting thread must
> acquire the mutex lock before it can return from pthread_cond_wait).
>
At least I was told otherwise and [1] backs my knowledge up. Are you
really sure?
-Peter
http://docs.sun.com/app/docs/doc/806-5257/6je9h032r?a=view#sync-53686
next prev parent reply other threads:[~2007-12-16 19:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-15 23:18 [PATCH] threaded pack-objects: Use condition variables for thread communication Johannes Sixt
2007-12-16 12:05 ` Peter Baumann
2007-12-16 18:41 ` Johannes Sixt
2007-12-16 19:00 ` Peter Baumann [this message]
2007-12-16 19:45 ` [PATCH v2] " Johannes Sixt
2007-12-16 22:12 ` Junio C Hamano
2007-12-17 3:13 ` Nicolas Pitre
2007-12-17 7:44 ` Johannes Sixt
2007-12-17 19:12 ` [PATCH] Plug a resource leak in threaded pack-objects code Johannes Sixt
2007-12-17 4:26 ` [PATCH] threaded pack-objects: Use condition variables for thread communication Dmitry Potapov
2007-12-16 19:18 ` David Brown
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=20071216190016.GC4999@xp.machine.xx \
--to=waste.manager@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=johannes.sixt@telecom.at \
--cc=nico@cam.org \
/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 NNTP newsgroup(s).