[M3commit] CVS Update: cm3

Jay Krell jkrell at elego.de
Fri Dec 11 16:44:56 CET 2009


CVSROOT:	/usr/cvs
Changes by:	jkrell at birch.	09/12/11 16:44:56

Modified files:
	cm3/m3-libs/m3core/src/thread/WIN32/: ThreadWin32.m3 

Log message:
	"Rewrite" alerting to use a separate event
	This cuts out a large use of the giant lock.
	There is no longer the two booleans alerted and alertable.
	"alertable" isn't needed, just have Alert set the event.
	alerted is embodied in the event's state.
	
	Atomtic test and clear alerted is provided by WaitForSingleObject
	and an auto reset event.
	
	downsides:
	Thread is larger -- two booleans (two bytes) replaced by a handle
	Thread is slower to create -- an extra kernel object.
	TestAlert is much slower: WaitForSingleObject(timeout = 0) a kernel
	call instead of reading a boolean (possibly under giant lock, but
	the giant lock holds do/did all appear brief, judging from the code)
	We /might/ be able to delay creating the handle? Until someone
	does an AlertWait or Alert? We might be able to synthesize
	alerting with Interlocked? Maybe but having two events seems good.
	
	possible alternatives:
	the boolean for alerted could come from elsewhere,
	in particular the Win32 alerted feature
	Downside here is I'm not sure how to easily set it on Win9x.
	On NT it is simply QueueUserAPC (introduced in what version?)
	Maybe it is by completing arbitrary I/O to an arbitrary handle?
	
	upsides:
	one more large dent toward removing the giant lock and hopefully
	therefore being much more scalable
	And we know how to remove it entirely, without dropping pre-Vista support
	(do like Java, with its tricky counters/tickets system)




More information about the M3commit mailing list