Page 1 of 1

[Implemented] Add support for Win32 critical sections

Posted: Sat Nov 05, 2016 10:15 pm
by Mistrel
On Linux and OSX, POSIX mutexes act as critical sections, but on Windows they have additional kernel overhead as they can be shared between processes.

It would be nice if PureBasic could add support for the "critical section" idiom to wrap Win32 functionality and default back to mutexes on other OSs. I am currently using a #CompilerIf but it would be nice if this were abstracted away for me.

Re: Add support for Win32 critical sections to Thread librar

Posted: Sat Nov 05, 2016 11:17 pm
by freak
What is called a "Mutex" in PB is actually implemented on Windows using the CriticalSection APIs. We don't use the Windows kernel object called "Mutex".

Re: Add support for Win32 critical sections to Thread librar

Posted: Sun Nov 06, 2016 2:31 pm
by blueb
Thanks Freak.
quidquid Latine dictum sit altum videtur
How true! :D

Re: Add support for Win32 critical sections to Thread librar

Posted: Sun Nov 06, 2016 7:15 pm
by Mistrel
Thanks for the tip. :)