[M3devel] refactoring threadwin32/threadpthread

Jay K jay.krell at cornell.edu
Sun Nov 22 06:52:03 CET 2009


Tony, it seems to me that ThreadWin32.m3 / ThreadPThread.m3 can be largely combined into common code.

 

If you come up with common names for

 EnterCriticalSection vs. pthread_mutex_lock => SysLock?

 LeaveCriticalSection vs. pthread_mutex_unlock => SysUnlock?

 TlsGetValue vs. pthread_getspecific => PerThreadGet?

 TlsAlloc vs. pthread_key_create => PerThreadAlloc?

 etc.

 

Then you can make a bunch of the code identical.

 

I realize there is a more serious diversion wrt condition variables not being supported (unless

we drop pre-Vista support, which I'm not inclined to).

 

ThreadSuspend/Resume I think is already somewhat abstracted,

due to how Darwin/FreeBSD are written.

The Win32 names are pretty good in many places imho.

 

There may even be commonality with ThreadPosix.m3.

 

 

You know, we have:

ThreadPosix.m3 1400 lines

ThreadPThread.m3 1400 lines

ThreadWin32.m3 1000 lines

 

surely we don't need that much.

 

 

 - Jay






 
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20091122/a65a44c8/attachment-0001.html>


More information about the M3devel mailing list