[M3devel] modula-3/pthreads
Neil T. Dantam
ndantam at purdue.edu
Sun May 18 22:08:20 CEST 2008
Jay wrote:
> Given that pthreads has all of mutex, rwlock, and most importantly
> condition variables, couldn't ThreadPThread.m3 be very much thinner?
Much of that is Object wrappers around the pthread primitives.
This is necessary so that we can garbage collect these types.
Also, RWLocks aren't really standard pthreads, but they seem to be
implemented on the platforms we currently care about.
> Like, not do any of its own scheduling?
The condition variable implementation does seem to do more than
necessary. Perhaps this is so that it will do the right thing on
pthreads implementations that don't?
We also need to wrap pthread_create to maintain some thread local state
used for GC and probably other things as well. It may be possible to
achieve this another way (ie using gcc's thread-local builtins), but
that would be a nontrivial change.
> Also, shouldn;t the attr for stack size be destroyed? Else leak on
> some platforms?
Probably.
> Is it even needed at all?
Not on linux, at least.
--
Neil
More information about the M3devel
mailing list