aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/threads.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-04-16 06:11:40 -0700
committerChris Robinson <[email protected]>2014-04-16 06:11:40 -0700
commitd124aee4d78db389117a8eda60c12a829489622b (patch)
tree71b50e2e25b8089088ce46fd8bfd045a3e5451d3 /Alc/threads.c
parent505ef82246d608970e291289c1087ed42f444281 (diff)
Remove the old thread wrappers for the new ones
Diffstat (limited to 'Alc/threads.c')
-rw-r--r--Alc/threads.c118
1 files changed, 2 insertions, 116 deletions
diff --git a/Alc/threads.c b/Alc/threads.c
index d910716c..10109630 100644
--- a/Alc/threads.c
+++ b/Alc/threads.c
@@ -46,59 +46,6 @@ extern inline int almtx_trylock(almtx_t *mtx);
#include <windows.h>
#include <mmsystem.h>
-typedef struct althread_info {
- ALuint (*func)(ALvoid*);
- ALvoid *ptr;
- HANDLE hdl;
-} althread_info;
-
-static DWORD CALLBACK StarterFunc(void *ptr)
-{
- althread_info *inf = (althread_info*)ptr;
- ALuint ret;
-
- ret = inf->func(inf->ptr);
- ExitThread((DWORD)ret);
-
- return (DWORD)ret;
-}
-
-
-ALboolean StartThread(althread_t *thread, ALuint (*func)(ALvoid*), ALvoid *ptr)
-{
- althread_info *info;
- DWORD dummy;
-
- info = malloc(sizeof(*info));
- if(!info) return AL_FALSE;
-
- info->func = func;
- info->ptr = ptr;
-
- info->hdl = CreateThread(NULL, THREAD_STACK_SIZE, StarterFunc, info, 0, &dummy);
- if(!info->hdl)
- {
- free(info);
- return AL_FALSE;
- }
-
- *thread = info;
- return AL_TRUE;
-}
-
-ALuint StopThread(althread_t thread)
-{
- DWORD ret = 0;
-
- WaitForSingleObject(thread->hdl, INFINITE);
- GetExitCodeThread(thread->hdl, &ret);
- CloseHandle(thread->hdl);
-
- free(thread);
-
- return (ALuint)ret;
-}
-
void SetThreadName(const char *name)
{
@@ -243,66 +190,9 @@ int almtx_timedlock(almtx_t *mtx, const struct timespec *ts)
#include <pthread_np.h>
#endif
-typedef struct althread_info {
- ALuint (*func)(ALvoid*);
- ALvoid *ptr;
- ALuint ret;
- pthread_t hdl;
-} althread_info;
-
-static void *StarterFunc(void *ptr)
-{
- althread_info *inf = (althread_info*)ptr;
- inf->ret = inf->func(inf->ptr);
- return NULL;
-}
-
-ALboolean StartThread(althread_t *thread, ALuint (*func)(ALvoid*), ALvoid *ptr)
-{
- pthread_attr_t attr;
- althread_info *info;
-
- info = malloc(sizeof(*info));
- if(!info) return AL_FALSE;
-
- if(pthread_attr_init(&attr) != 0)
- {
- free(info);
- return AL_FALSE;
- }
- if(pthread_attr_setstacksize(&attr, THREAD_STACK_SIZE) != 0)
- {
- pthread_attr_destroy(&attr);
- free(info);
- return AL_FALSE;
- }
-
- info->func = func;
- info->ptr = ptr;
- if(pthread_create(&info->hdl, &attr, StarterFunc, info) != 0)
- {
- pthread_attr_destroy(&attr);
- free(info);
- return AL_FALSE;
- }
- pthread_attr_destroy(&attr);
-
- *thread = info;
- return AL_TRUE;
-}
-
-ALuint StopThread(althread_t thread)
-{
- ALuint ret;
-
- pthread_join(thread->hdl, NULL);
- ret = thread->ret;
-
- free(thread);
-
- return ret;
-}
+extern inline althrd_t althrd_current(void);
+extern inline int althrd_sleep(const struct timespec *ts, struct timespec *rem);
void SetThreadName(const char *name)
@@ -322,10 +212,6 @@ void SetThreadName(const char *name)
}
-extern inline althrd_t althrd_current(void);
-extern inline int althrd_sleep(const struct timespec *ts, struct timespec *rem);
-
-
typedef struct thread_cntr {
althrd_start_t func;
void *arg;