home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
memsz331.zip
/
Source.zip
/
MUTEX.H
< prev
next >
Wrap
Text File
|
1995-05-25
|
1KB
|
43 lines
/******************************************************************** MUTEX.H
* *
* MUTEX Semaphore Class *
* *
****************************************************************************/
#ifndef MUTEX_H
#define MUTEX_H
class Mutex
{
private:
HMTX Handle ;
public:
Mutex ( PSZ Name )
{
APIRET Status = DosCreateMutexSem ( Name, &Handle, 0, FALSE ) ;
if ( Status )
{
extern VOID Log ( char *Message, ... ) ;
Log ( "MUTEX: Unable to create semaphore '%s'.\r\n", Name ) ;
}
}
~Mutex ( )
{
DosCloseMutexSem ( Handle ) ;
}
APIRET Request ( int Timeout )
{
return ( DosRequestMutexSem ( Handle, Timeout ) ) ;
}
APIRET Release ( )
{
return ( DosReleaseMutexSem ( Handle ) ) ;
}
} ;
#endif