aboutsummaryrefslogtreecommitdiff
path: root/include/w32threadwrap.h
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2022-06-26 16:45:52 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2022-07-08 19:17:35 +0200
commit2087cc237cd0fe1ed29ebf891648bacb46f4833b (patch)
treeede4ba232bea36d8fc670ce360514927a2400bc7 /include/w32threadwrap.h
parentaed35c78c6a51a4b4c37ebda5643d2246842fb74 (diff)
Cleanup: move libutil headers to sub directory
Move all the libutil stuff from the toplevel include/ to a util/ sub directory and fix up the includes that make use of them. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include/w32threadwrap.h')
-rw-r--r--include/w32threadwrap.h105
1 files changed, 0 insertions, 105 deletions
diff --git a/include/w32threadwrap.h b/include/w32threadwrap.h
deleted file mode 100644
index 6b7344c..0000000
--- a/include/w32threadwrap.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* SPDX-License-Identifier: LGPL-3.0-or-later */
-/*
- * w32threadwrap.h
- *
- * Copyright (C) 2021 David Oberhollenzer <goliath@infraroot.at>
- */
-#ifndef W32THREADWRAP_H
-#define W32THREADWRAP_H
-
-#include "sqfs/predef.h"
-
-#define WIN32_LEAN_AND_MEAN
-#define VC_EXTRALEAN
-#include <windows.h>
-
-typedef unsigned int sigset_t;
-typedef HANDLE pthread_t;
-typedef CRITICAL_SECTION pthread_mutex_t;
-typedef CONDITION_VARIABLE pthread_cond_t;
-
-static inline int pthread_create(pthread_t *thread, const void *attr,
- LPTHREAD_START_ROUTINE proc, LPVOID arg)
-{
- HANDLE hnd = CreateThread(NULL, 0, proc, arg, 0, 0);
- (void)attr;
-
- if (hnd == NULL)
- return -1;
-
- *thread = hnd;
- return 0;
-}
-
-static int pthread_join(pthread_t thread, void **retval)
-{
- WaitForSingleObject(thread, INFINITE);
- CloseHandle(thread);
- if (retval != NULL)
- *retval = NULL;
- return 0;
-}
-
-static inline int pthread_mutex_init(pthread_mutex_t *mutex, const void *attr)
-{
- (void)attr;
- InitializeCriticalSection(mutex);
- return 0;
-}
-
-static inline int pthread_mutex_lock(pthread_mutex_t *mutex)
-{
- EnterCriticalSection(mutex);
- return 0;
-}
-
-static inline int pthread_mutex_unlock(pthread_mutex_t *mutex)
-{
- LeaveCriticalSection(mutex);
- return 0;
-}
-
-static inline void pthread_mutex_destroy(pthread_mutex_t *mutex)
-{
- DeleteCriticalSection(mutex);
-}
-
-static inline int pthread_cond_init(pthread_cond_t *cond, const void *attr)
-{
- (void)attr;
- InitializeConditionVariable(cond);
- return 0;
-}
-
-static inline int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mtx)
-{
- return SleepConditionVariableCS(cond, mtx, INFINITE) != 0;
-}
-
-static inline int pthread_cond_broadcast(pthread_cond_t *cond)
-{
- WakeAllConditionVariable(cond);
- return 0;
-}
-
-static inline void pthread_cond_destroy(pthread_cond_t *cond)
-{
- (void)cond;
-}
-
-#define SIG_SETMASK (0)
-
-static inline int sigfillset(sigset_t *set)
-{
- *set = 0xFFFFFFFF;
- return 0;
-}
-
-static inline int pthread_sigmask(int how, const sigset_t *set,
- const sigset_t *old)
-{
- (void)how; (void)set; (void)old;
- return 0;
-}
-
-#endif /* W32THREADWRAP_H */