mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-09-07 16:54:28 +00:00
native windows mutexes as (fast) critical sections
This commit is contained in:
parent
22efcbc6e4
commit
ceba60d76f
@ -27,8 +27,19 @@ BOOL exists( const char *path );
|
|||||||
int32 get_file_size( const char *path );
|
int32 get_file_size( const char *path );
|
||||||
BOOL create_file( const char *path, DWORD size );
|
BOOL create_file( const char *path, DWORD size );
|
||||||
|
|
||||||
|
// Thread wrappers
|
||||||
extern HANDLE create_thread(LPTHREAD_START_ROUTINE start_routine, void *arg = NULL);
|
extern HANDLE create_thread(LPTHREAD_START_ROUTINE start_routine, void *arg = NULL);
|
||||||
extern void wait_thread(HANDLE thread);
|
extern void wait_thread(HANDLE thread);
|
||||||
extern void kill_thread(HANDLE thread);
|
extern void kill_thread(HANDLE thread);
|
||||||
|
|
||||||
|
// Mutex wrappers
|
||||||
|
class mutex_t {
|
||||||
|
CRITICAL_SECTION cs;
|
||||||
|
public:
|
||||||
|
mutex_t() { InitializeCriticalSection(&cs); }
|
||||||
|
~mutex_t() { DeleteCriticalSection(&cs); }
|
||||||
|
void lock() { EnterCriticalSection(&cs); }
|
||||||
|
void unlock() { LeaveCriticalSection(&cs); }
|
||||||
|
};
|
||||||
|
|
||||||
#endif // _UTIL_WINDOWS_H
|
#endif // _UTIL_WINDOWS_H
|
||||||
|
Loading…
Reference in New Issue
Block a user