mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-09-07 16:54:28 +00:00
thread wrappers
This commit is contained in:
parent
ef8e363c5c
commit
2bbbde1e2b
@ -83,3 +83,25 @@ int32 get_file_size( const char *path )
|
|||||||
}
|
}
|
||||||
return(size);
|
return(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Thread wrappers
|
||||||
|
*/
|
||||||
|
|
||||||
|
HANDLE create_thread(LPTHREAD_START_ROUTINE start_routine, void *arg)
|
||||||
|
{
|
||||||
|
DWORD dwThreadId;
|
||||||
|
return CreateThread(NULL, 0, start_routine, arg, 0, &dwThreadId);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wait_thread(HANDLE thread)
|
||||||
|
{
|
||||||
|
WaitForSingleObject(thread, INFINITE);
|
||||||
|
CloseHandle(thread);
|
||||||
|
}
|
||||||
|
|
||||||
|
void kill_thread(HANDLE thread)
|
||||||
|
{
|
||||||
|
TerminateThread(thread, 0);
|
||||||
|
}
|
||||||
|
@ -27,4 +27,8 @@ 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 );
|
||||||
|
|
||||||
|
extern HANDLE create_thread(LPTHREAD_START_ROUTINE start_routine, void *arg = NULL);
|
||||||
|
extern void wait_thread(HANDLE thread);
|
||||||
|
extern void kill_thread(HANDLE thread);
|
||||||
|
|
||||||
#endif // _UTIL_WINDOWS_H
|
#endif // _UTIL_WINDOWS_H
|
||||||
|
Loading…
Reference in New Issue
Block a user