Skip to content

Commit

Permalink
🎨 threadpools win fix again and again
Browse files Browse the repository at this point in the history
  • Loading branch information
fennecdjay committed Sep 25, 2023
1 parent 930eddc commit 6ea4727
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions include/threadpool.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ ANN void free_threadpool(threadpool_t *pool);

#ifdef BUILD_ON_WINDOWS
ANN static inline int gwt_lock(gwtlock_t *lock) {
EnterCriticalSection(lock);
EnterCriticalSection(*lock);
return 0;
}
ANN static inline int gwt_unlock(gwtlock_t *lock) {
LeaveCriticalSection(lock);
LeaveCriticalSection(*lock);
return 0;
}
ANN static inline void gwt_wait(gwtcond_t *cond, gwtlock_t *lock) {
SleepConditionVariableCS(cond, lock, INFINITE); // bool
SleepConditionVariableCS(*cond, *lock, INFINITE); // bool
}
ANN static inline int gwt_broadcast(gwtcond_t *cond) {
WakeAllConditionVariable(*cond);
Expand All @@ -49,14 +49,17 @@ ANN static inline int gwt_signal(gwtcond_t *cond) {
return 0;
}
ANN static inline void gwt_create(gwtthread_t *thread, void* (*fun)(void*), void *arg) {
*thread = CreateThread(NULL, 0, func, arg, 0, NULL);
*thread = CreateThread(NULL, 0, fun, arg, 0, NULL);
}
ANN static inline void gwt_join(gwtthread_t thread) {
WaitForSingleObject(thread, INFINITE); // dword // (DWORD)0xFFFFFFFF on error
}
ANN static inline void gwt_lock_end(gwtlock_t *lock) {
return DeleteCriticalSection(*lock);
}
ANN static inline void gwt_lock_ini(gwtlock_t *lock) {
return InitializeCriticalSection(*lock);
}
ANN static inline void gwt_cond_end(gwtcond_t *cond) {}
#else
ANN static inline int gwt_lock(gwtlock_t *lock) {
Expand Down

0 comments on commit 6ea4727

Please sign in to comment.