Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact


Moderators: larsivi kris

Posted: 11/18/07 11:22:49

Hi, I want a thread-safe win32 gui and one of the requirements are CriticalSections?. Like :

	// This class is used for thread synchronisation
	class CCriticalSection
		this()	{InitializeCriticalSection(&m_cs);}
		~this()	{DeleteCriticalSection(&m_cs);}

		void Lock() {EnterCriticalSection(&m_cs);}
		void Release()	{LeaveCriticalSection(&m_cs);}


Well I can use this WINAPI functions, but I would prefer to use Tango functions instead. (to leave the chance for a platform independent GUI) Unfortunately I have not found something similar. Ideas ? Many thanks in advance, Bjoern

Author Message

Posted: 11/18/07 13:00:03

I once used CriticalSections in C++ on win32, but sure i am no expert in this. I think you can use tango.core.sync.Mutex, but there might be significant differences to CriticalSection. Try Google to find out.

There is also an example in example/synchronization/Mutex.d