Support for multiple threading models

Robert Lunnon bobl at
Sat May 7 03:37:59 CDT 2005

Some time ago, I wrote code to support native threads instead of lwp for SYSV 
operating systems, the way I wrote the code all available threading models 
were compiled into wine and the actual one to be used was selected by setting 
an environment variable. (Currently WINE_THREADMODE). On OSes that support 
multiple threading methods, IE Solaris and probably the BSDs this allows for 
easy development and testing of thread support. It also allows the simulation 
of no thread support (Not that that seems to be very useful).

Originally when I wrote this Solaris 9 was having some problems with crashing 
in mutexes if native threads were used, but LWPs weren't perfect either, in 
particular lwps aren't necessarily safe to use with some libraries  (There is 
a warning about this in the Man pages for the _lwp calls, For example. this 
caused problems with alarm/usleep calls used at the time in winmm). These 
days however in Solaris 10 the native thread code works quite well.

Anyway the fallout was that non winmm code worked best using native threads on 
certain Solaris MUs  and winmm dependent programs worked best using LWPs and 
having the Threading model selectable made sense. This is still the case for 
Solaris 8/9 users.

I can still see situations where it would be advantageous to be able to select 
the threading model at runtime and I'd like to leave this support in (Solaris 
9 for example). This possibility has received a luke warm reception before 
but I thought I'd re-raise the possibility now while I'm doing the putback 
from my latest patch kit.

Just as a final point Solaris no longer supports _lwp_create calls, without 
this patch wine is unable to run on Solaris versions > Solaris 9


Threading patch attached
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kthread.c.diff
Type: text/x-diff
Size: 11089 bytes
Desc: not available
Url :

More information about the wine-devel mailing list