From: Nicolas Pitre <nico@fluxnic.net>
To: Daniel Barkalow <barkalow@iabervon.org>
Cc: "Andrzej K. Haczewski" <ahaczewski@gmail.com>,
Johannes Sixt <j.sixt@viscovery.net>,
git@vger.kernel.org
Subject: Re: [PATCH] MSVC: port pthread code to native Windows threads
Date: Wed, 04 Nov 2009 16:17:15 -0500 (EST) [thread overview]
Message-ID: <alpine.LFD.2.00.0911041607250.10340@xanadu.home> (raw)
In-Reply-To: <alpine.LNX.2.00.0911041406101.14365@iabervon.org>
On Wed, 4 Nov 2009, Daniel Barkalow wrote:
> On Wed, 4 Nov 2009, Andrzej K. Haczewski wrote:
>
> > 2009/11/4 Johannes Sixt <j.sixt@viscovery.net>:
> > >
> > > You are right. But #ifdef THREADED_DELTA_SEARCH is about a "generic"
> > > property of the code and is already used elsewhere in the file, whereas
> > > #ifdef WIN32 would be new and is is about platform differences.
> > >
> > > Anyway, we would have to see what Junio says about the new function calls,
> > > because he's usually quite anal when it comes to added code vs. static
> > > initialization. ;)
> >
> > I could do it with wrappers for pthread_mutex_lock and _unlock and
> > lazy init there plus lazy init cond var in cond_wait and _signal, that
> > way it could be done without any additional code in the first #ifdef.
> > But I don't see any simple solution for working around
> > deinitialization, that's why I'd leave non-static initialization. Let
> > me put some touchups and resubmit for another round.
>
> Is it actually necessary to deinitialize? Since the variables are static
> and therefore can't leak, and would presumably not need to be
> reinitialized differently if they were used again, I think they should be
> able to just stay. If Windows is unhappy about processes still having
> locks initialized at exit, I suppose we could go through and destroy all
> our mutexes and conds at cleanup time. Pthreads does have the appropriate
> functions, and it would be correct to use them, although unnecessary.
Lazy initialization would probably turn up to be more expensive
(checking a flag on each usage) than unconditionally initializing them
once. Remember that those are used at least once per object meaning a
lot.
And I much prefer having runtime initialization for both Unix and
Windows than having separate paths on each platform potentially hiding
different bugs. And given that on Unix you can statically initialize
those, then a runtime initialization is certainly not going to be _that_
costly.
And while at it, we might just deinitialize them as soon as we're done
with them saving resources (on Unix that might turn up to be a no op
anyway) which is why I suggested doing this within ll_find_deltas()
directly.
Nicolas
next prev parent reply other threads:[~2009-11-04 21:17 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-03 21:30 [PATCH 0/1] Port of pthreads to Windows API threads Andrzej K. Haczewski
2009-11-03 21:30 ` [PATCH 1/1] MSVC: port pthread code to native Windows threads Andrzej K. Haczewski
2009-11-03 23:38 ` Johannes Schindelin
2009-11-04 2:34 ` Joshua Jensen
2009-11-04 7:44 ` Andrzej K. Haczewski
2009-11-04 8:24 ` Johannes Sixt
2009-11-04 11:02 ` Johannes Schindelin
2009-11-04 8:17 ` Andrzej K. Haczewski
2009-11-04 8:15 ` Johannes Sixt
2009-11-04 8:48 ` Michael Wookey
2009-11-04 10:53 ` Andrzej K. Haczewski
2009-11-04 10:37 ` [PATCH] " Andrzej K. Haczewski
2009-11-04 10:50 ` Erik Faye-Lund
2009-11-04 10:56 ` Andrzej K. Haczewski
2009-11-04 11:14 ` Paolo Bonzini
2009-11-04 11:23 ` Paolo Bonzini
2009-11-04 12:39 ` Johannes Sixt
2009-11-04 13:47 ` Andrzej K. Haczewski
2009-11-04 14:34 ` Johannes Sixt
2009-11-04 14:50 ` Andrzej K. Haczewski
2009-11-04 20:43 ` Daniel Barkalow
2009-11-04 21:17 ` Nicolas Pitre [this message]
2009-11-04 22:22 ` Daniel Barkalow
2009-11-05 0:27 ` Nicolas Pitre
2009-11-05 13:48 ` Dmitry Potapov
2009-11-04 14:14 ` Andrzej K. Haczewski
2009-11-04 14:19 ` Erik Faye-Lund
2009-11-04 14:04 ` Johannes Schindelin
2009-11-04 15:55 ` [PATCH] MSVC: Windows-native implementation for subset of Pthreads API Andrzej K. Haczewski
2009-11-04 18:10 ` Nicolas Pitre
2009-11-04 21:16 ` Andrzej K. Haczewski
2009-11-04 21:32 ` [PATCH] pack-objects: move thread autodetection closer to relevant code Nicolas Pitre
2009-11-06 7:20 ` Junio C Hamano
2009-11-04 21:41 ` [PATCH] MSVC: Windows-native implementation for subset of Pthreads API Erik Faye-Lund
2009-11-04 22:50 ` Andrzej K. Haczewski
2009-11-05 2:47 ` Nicolas Pitre
2009-11-05 9:00 ` Andrzej K. Haczewski
2009-11-05 9:41 ` Erik Faye-Lund
2009-11-05 10:18 ` Andrzej K. Haczewski
2009-11-05 12:27 ` Johannes Sixt
2009-11-05 12:53 ` Andrzej K. Haczewski
2009-11-05 19:25 ` Nicolas Pitre
2009-11-05 20:38 ` Andrzej K. Haczewski
2009-11-05 22:15 ` Nicolas Pitre
2009-11-04 21:52 ` Nicolas Pitre
2009-11-04 23:47 ` Andrzej K. Haczewski
2009-11-04 23:57 ` Andrzej K. Haczewski
2009-11-05 0:22 ` Nicolas Pitre
2009-11-05 8:51 ` Andrzej K. Haczewski
2009-11-05 19:22 ` Nicolas Pitre
2009-11-05 2:10 ` Nicolas Pitre
2009-11-05 8:45 ` Andrzej K. Haczewski
2009-11-05 19:17 ` Nicolas Pitre
2009-11-05 7:33 ` Johannes Sixt
2009-11-04 23:58 ` Junio C Hamano
2009-11-05 16:45 ` Andrzej K. Haczewski
2009-11-05 17:31 ` Johannes Sixt
2009-11-05 19:39 ` Nicolas Pitre
2009-11-05 20:09 ` Andrzej K. Haczewski
2009-11-05 20:36 ` Nicolas Pitre
2009-11-06 8:10 ` Andrzej K. Haczewski
2009-11-06 8:25 ` Johannes Sixt
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=alpine.LFD.2.00.0911041607250.10340@xanadu.home \
--to=nico@fluxnic.net \
--cc=ahaczewski@gmail.com \
--cc=barkalow@iabervon.org \
--cc=git@vger.kernel.org \
--cc=j.sixt@viscovery.net \
/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).