thread wrappers

This commit is contained in:
gbeauche 2004-12-11 09:41:13 +00:00
parent ef8e363c5c
commit 2bbbde1e2b
2 changed files with 26 additions and 0 deletions

View File

@ -83,3 +83,25 @@ int32 get_file_size( const char *path )
}
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);
}

View File

@ -27,4 +27,8 @@ BOOL exists( const char *path );
int32 get_file_size( const char *path );
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