-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
83745fd
commit 2fa9d9f
Showing
14 changed files
with
354 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ run*.sh | |
server | ||
/dllama | ||
/dllama-* | ||
*.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#ifndef PTHREAD_WRAPPER | ||
#define PTHREAD_WRAPPER | ||
|
||
#ifdef _WIN32 | ||
#include <windows.h> | ||
|
||
typedef HANDLE dl_thread; | ||
typedef DWORD thread_ret_t; | ||
typedef DWORD (WINAPI *thread_func_t)(void *); | ||
|
||
static int pthread_create(dl_thread * out, void * unused, thread_func_t func, void * arg) { | ||
(void) unused; | ||
dl_thread handle = CreateThread(NULL, 0, func, arg, 0, NULL); | ||
if (handle == NULL) { | ||
return EAGAIN; | ||
} | ||
|
||
*out = handle; | ||
return 0; | ||
} | ||
|
||
static int pthread_join(dl_thread thread, void * unused) { | ||
(void) unused; | ||
DWORD ret = WaitForSingleObject(thread, INFINITE); | ||
if (ret == WAIT_FAILED) { | ||
return -1; | ||
} | ||
CloseHandle(thread); | ||
return 0; | ||
} | ||
#else | ||
#include <pthread.h> | ||
|
||
typedef pthread_t dl_thread; | ||
typedef void* thread_ret_t; | ||
typedef void* (*thread_func_t)(void *); | ||
|
||
#endif | ||
|
||
#endif // PTHREAD_WRAPPER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.