This is the mail archive of the cygwin-developers@cygwin.com 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: snapshot 20050114 race (on list)


On Mon, Jan 17, 2005 at 11:31:01AM -0500, Pierre A. Humblet wrote:
>Christopher Faylor wrote:
>>Thanks.  That script unearthed at least two races in the proc_waiter
>>code.  One was a "how in the world could it ever work" type.  I was
>>inadvertently relying on the fact that the last process created would
>>be the first process to exit.  It's amazing that this passed the test
>>suite.  I guess I need to beef up that aspect of it.
>
>I had never noticed that procs was an array of pinfo's, and not an
>array of pointers to pinfos, and that pinfo's were being copied when
>processes terminate and in proc_waiter.
>
>But pinfo's contain a CRITICAL_SECTION and according to
><http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/initializecriticalsection.asp>:
>A critical section object cannot be moved or copied.  The process must
>also not modify the object, but must treat it as logically opaque.  Use
>only the critical section functions to manage critical section objects.
>When you have finished using the critical section, call the
>DeleteCriticalSection function.

The CRITICAL_SECTION is only used for "myself" currently.  I added it to
pinfo a while ago because I thought I could use it for other stuff but I
never did.  The only way I could see this being a problem is if the
process had execed and then tried to use the lock in another thread,
which is extremely unlikely to occur.

However, I probably should pull it out of pinfo because there's no
reason for it to be there, taking up space in every pinfo, just for the
case of locking myself.

cgf


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