[M3commit] CVS Update: cm3

Antony Hosking hosking at elego.de
Mon Aug 6 18:35:44 CEST 2007

CVSROOT:	/usr/cvs
Changes by:	hosking at birch.	07/08/06 18:35:44

Modified files:
	cm3/m3-libs/m3core/src/thread/PTHREAD/: ThreadPThread.m3 

Log message:
	The problem with the pure pthread condition = M3 condition strategy is that it
	doesn't play well with alerts on Mac OS X.  It turns out signalling the
	alerted thread won't wake it up from pthread_cond_wait or
	pthread_cond_timedwait, as it will under Linux.  This is a problem, since it
	means alerted threads can hang around until the main thread exits, leaving no
	thread active.  Moreover, the timeout does not seem to get delivered even to a
	thread waiting on pthread_cond_timedwait, so we can't even use a polling
	approach.  Thus, I am reverting to the older style of condition using explicit
	queues and a per-thread wait condition, which we can signal on alert to wake
	up threads in pthread_cond_wait/pthread_cond_timedwait.
	In any case, this thread implementation is tested on both Mac OSX Darwin and
	Linux.  i.e., GUI apps like mentor work correctly.
	I will look at coming up with a hybrid implementation that retains 1-1 mapping
	of M3 mutexes to pthread mutexes, but implements M3 conditions as they are
	in this update, with explicit queues.  That way, we will have scalability of
	avoiding global locks for mutexes, while retaining desirable M3 alert

More information about the M3commit mailing list