Login  Register

Re: How to CreateMutex in Dolphin?

Posted by Sean Malloy-6 on Sep 22, 2004; 5:50am
URL: https://forum.world.st/How-to-CreateMutex-in-Dolphin-tp3371535p3371537.html

Mark,

> Do I maybe have to import/declare this Win32 API function myself or?

Yep.

Biggest help I have found, is having a copy of the Win32 ref (a .hlp file).
Makes for importing api calls much easier.

Define the required loose methods, and maybe even create a class called
NamedMutex or something...

Heres the Kernel call..

KernelLibrary>>createMutex: aSECURITYATTRIBUTES bInitialOwner: aBoolOwner
lpName: aStringName
"Answer a new Win32 Handle"
"HANDLE CreateMutex(

    LPSECURITY_ATTRIBUTES lpMutexAttributes, // pointer to security
attributes
    BOOL bInitialOwner, // flag for initial ownership
    LPCTSTR lpName  // pointer to mutex-object name
   );

"
<stdcall: handle CreateMutex lpvoid bool lpstr>
^self invalidCall

make sure you implement ReleaseMutex as well

KernelLibrary>>releaseMutex: aHandle
"Cleans up an existing mutex"
"BOOL ReleaseMutex(
    HANDLE hMutex // handle of mutex object
   );
"
<stdcall: bool ReleaseMutex handle>
^self invalidCall

I've uploaded the win32 api ref here if you don't already have it:

http://www.arcturus.com.au/win32.zip