[M3commit] CVS Update: cm3

Tony Hosking hosking at cs.purdue.edu
Wed Apr 22 02:05:44 CEST 2009


I believe gcc has some threadlocal declaration mechanisms too that we  
might exploit from C.

On 21 Apr 2009, at 13:02, Jay Krell wrote:

> CVSROOT:	/usr/cvs
> Changes by:	jkrell at birch.	09/04/21 13:02:12
>
> Modified files:
> 	cm3/m3-libs/m3core/src/thread/WIN32/: ThreadWin32.m3 m3makefile
> Added files:
> 	cm3/m3-libs/m3core/src/thread/WIN32/: ThreadWin32.i3
> 	                                      ThreadWin32C.c
>
> Log message:
> 	Experimentally transform like pthread and move the criticalsections  
> and threadlocal
> 	to C and wrap thinly.
> 	
> 	This hides from Modula-3 the need to know the size of a critical  
> section, though
> 	this seems like a smaller problem on the single vendor few kernel  
> Win32 (NT, CE,
> 	and NT and 9x are binary compatible) than
> 	the multi vendor many kernel Posix. There are other cloned header  
> dependencies here
> 	not factored into C (SuspendThread, ResumeThread,  
> MEMORY_BASIC_INFO, etc.)
> 	
> 	Note that Modula-3 does and long has done leak its criticalsections  
> and threadlocals.
> 	We should probably address that.
> 	More generally there should perhaps be module destructors, though  
> like Win32
> 	it helps to know the ExitProcess() vs. FreeLibrary case. In  
> ExitProcess()
> 	it is a waste of time and to try to cleanup whereas in FreeLibrary  
> is a is good idea
> 	to cleanup.
> 	
> 	EnterCriticalSection(foo) => EnterCriticalSection_foo()
> 	likewise for
> 	LeaveCriticalSection
> 	TlsGetValue
> 	TlsSetValue
> 	InitializeCriticalSection and TlsAlloc bundled into InitC.
> 	Logic for TlsGetValue_foo() before TlsAlloc_foo() buried in  
> TlsGetValue_foo().
> 	
> 	In future, in Vista-specific code, besides condition variables, we  
> can use __declspec(thread) or such.
> 	(Posix/gcc platforms should use __thread..and more generally, no  
> matter the deficient underyling
> 	platforms, Modula-3 should consider <*threadlocal*>)




More information about the M3commit mailing list