[RFC] pthread emulation on FreeBSD (and Linux)

Patrik Stridvall ps at leissner.se
Sun Nov 24 12:44:08 CST 2002


With the attached patch FreeBSD compiles again
even if OpenGL (which need pthreads) is used.

Since it is only stubs at present OpenGL can't really work,
but Wine and the normal test runs fine ("make test").


Anyway, to answer the first obvious question:
Why didn't you just put it in scheduler/pthread.c?

Well, the thing is it didn't work. It still generates the
same link errors. However that is not very suprising since
the pthread_ implementation is in ntdll.dll which is
not linked with during the "-Bsymbolic -z defs" step.

This begs the question:
Does the Linux implementation of pthread really work anyway?

The thing is Linux (or rather the GNU C library) always links
in pthread suppport. However since some of the symbols are
on purpose defined as weak they can be overriden. This is
what scheduler/pthread.c does on Linux. Or rather tryies to
do. I'm not really sure if works any longer.

Note that if I apply the attach patch and compiles on
Linux it seems to work with "make test" as well.

Anyway be pthreads on Linux working properly as it may, the big
question is how do we support pthreads on both Linux and FreeBSD.

FreeBSD since it AFAICS have no default overridable implementation
seems to require that we have some sort of wine_pthread library to
implement pthreads from scratch like outlined in the attached patch.

I'm not really very good on how runtime linking on Linux and FreeBSD.
So, I would very much like comments from people more knowledgeable
than I on that area.

Comments? Suggestions?

PS. Can somebody test if OpenGL:s pthread locking REALLY works properly on
Linux?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pthread.diff
Type: application/octet-stream
Size: 6503 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20021124/83f385fd/pthread.obj


More information about the wine-devel mailing list