From ceba60d76f67629be054048232ea5161ef5845e4 Mon Sep 17 00:00:00 2001 From: gbeauche <> Date: Sat, 11 Dec 2004 10:16:42 +0000 Subject: [PATCH] native windows mutexes as (fast) critical sections --- BasiliskII/src/Windows/util_windows.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/BasiliskII/src/Windows/util_windows.h b/BasiliskII/src/Windows/util_windows.h index 5c2892f0..08d1b7bf 100755 --- a/BasiliskII/src/Windows/util_windows.h +++ b/BasiliskII/src/Windows/util_windows.h @@ -27,8 +27,19 @@ BOOL exists( const char *path ); int32 get_file_size( const char *path ); BOOL create_file( const char *path, DWORD size ); +// Thread wrappers extern HANDLE create_thread(LPTHREAD_START_ROUTINE start_routine, void *arg = NULL); extern void wait_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