Threading on Solaris

Gregg Mattinson gm138242 at scot.canada.sun.com
Thu Jul 25 14:04:06 CDT 2002


Hey everyone.  I've been trying to update threads by following Francois' 
directions, and I think I may have come across a bug.  Can someone help me out 
here...

Why does the SYSLEVEL structure have a CRITICAL_SECTION inside it?  Shouldn't a 
mutex be used instead?

According to MSDN, the function EnterCriticalSection has the following property:

  If a thread terminates while it has ownership of a critical section, the
  state of the critical section is undefined. 

Also, WaitForSingleObject returns WAIT_ABANDONED if:

  the specified object is a mutex object that was not released by the
  thread that owned the mutex object before the owning thread terminated.
  Ownership of the mutex object is granted to the calling thread, and the
  mutex is set to nonsignaled.

So, if a thread _EnterSysLevel and is then terminated, no other threads can 
enter that sys level.  This seems wrong to me...

Should I replace the CRITICAL_SECTION with a mutex?  Any objections?

Or, should EnterCriticalSection be fixed so that it has similar behaviour to 
WaitForSingleObject, instead of "undefined" behaviour (which is currently to 
block forever)

Let me know what you guys think,
Gregg Mattinson
Co-op Developer
Sun Microsystems of Canada

>From: Gregg Mattinson <gm138242 at opcom-mail.canada.sun.com>
>Subject: Re: Threading on Solaris
>To: wine-devel at winehq.com
>Cc: fgouget at codeweavers.com
>Date: Tue, 23 Jul 2002 07:21:46 -0400 (EDT)
>
>Threads on Solaris are a big issue for Sun, so I will start tackling this 
>problem today.  Thanks for telling me all the issues Francois.  I have a 
>hack-ish version implemented, and now I can create a real solution to the 
>problem.
>
>Gregg Mattinson
>Co-op Developer
>Sun Microsystems of Canada
>
>>From: Francois Gouget <fgouget at codeweavers.com>
>>To: wine-devel at winehq.com
>>CC: Gregg Mattinson <gm138242 at opcom-mail.canada.sun.com>
>>Subject: Threading on Solaris
>>Date: Tue, 23 Jul 2002 00:35:09 -0700
>>
>>Hi,
>>
>>
>>Some time ago I did some tests of Wine on Solaris x86 and found that 
>>there is a problem with the way we handle threads due to the differences 
>>between the Linux and Solaris threading models. These differences are 
>>also relevant for Solaris Sparc and probably many other Unices.
>>
>>Unfortunately I don't have time to work on it anymore so I created a bug 
>>report in Bugzilla where I tried to dump the relevant information, 
>>including a patch to illustrate the issues and the start of a fix. I 
>>hope it will be useful to someone... maybe Gregg who has been doing a 
>>lot of Solaris work recently.
>>
>>http://bugs.winehq.com/show_bug.cgi?id=904
>>
>>
>>-- 
>>Francois Gouget
>>fgouget at codeweavers.com
>




More information about the wine-devel mailing list