This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Cygwin 1.7: Concurrency Issue with Shared State Initialization


On Tue, Mar 09, 2010 at 10:18:27AM -0500, Christopher Faylor wrote:
>On Tue, Mar 09, 2010 at 12:36:08PM +0100, Corinna Vinschen wrote:
>>On Mar  9 11:08, Schmidt, Oliver wrote:
>>> Hi Christopher,
>>> 
>>> Fist of all thanks for your immediate feedback :-)
>>> 
>>> >>    /* Initialize installation root dir. */
>>> >>     if (!installation_root[0])
>>> >>       init_installation_root ();
>>> 
>>> > I'll check in something tonight which attempts to solve this problem.
>>> 
>>> Thanks in advance.
>>> 
>>> > It's a somewhat tricky problem because adding a mutex here would slow
>>> > down every invocation of a cygwin program and we don't want to add to
>>> > the "Why is Cygwin so slow???" scenarios if we can help it.
>>> 
>>> I understand your concern for sure ;-)
>>> 
>>> Maybe that's the very thing you're thinking about but ... AFAIK a
>>> spinlock is the usual paradigm in scenarios where one doesn't
>>> anticipate contention but needs to be aware of it 'just in case'. With
>>> InterlockedCompareExchange() and Sleep() it should be quite simple to
>>> create one that's very efficient in the usual scenario.
>>
>>Does the below patch fix this for you?
>
>I really do have a patch sitting in my sandbox.  I just forgot to test it
>last night.

And, as it turned out, it was a good thing that I had a night to sleep
on it.  I scrapped what I did yesterday and just piggybacked on the
already existing spinlock.  My previous attempt added additional testing
which wasn't really necessary.

http://cygwin.com/snapshots/ has what I hope is the fix for this.

cgf

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]