|
|
1.1 root 1: /*
2: * UAE - The Un*x Amiga Emulator
3: *
4: * Threading support, using SDL
5: *
6: * Copyright 1997, 2001 Bernd Schmidt
7: */
8:
1.1.1.2 ! root 9: #include <SDL.h>
! 10: #include <SDL_thread.h>
1.1 root 11:
12: /* Sempahores. We use POSIX semaphores; if you are porting this to a machine
13: * with different ones, make them look like POSIX semaphores. */
14: typedef SDL_sem *uae_sem_t;
15:
16: #define uae_sem_init(PSEM, DUMMY, INIT) do { \
17: *PSEM = SDL_CreateSemaphore (INIT); \
18: } while (0)
19: #define uae_sem_destroy(PSEM) SDL_DestroySemaphore (*PSEM)
20: #define uae_sem_post(PSEM) SDL_SemPost (*PSEM)
21: #define uae_sem_wait(PSEM) SDL_SemWait (*PSEM)
22: #define uae_sem_trywait(PSEM) SDL_SemTryWait (*PSEM)
23: #define uae_sem_getvalue(PSEM) SDL_SemValue (*PSEM)
24:
25: #include "commpipe.h"
26:
27: typedef SDL_Thread *uae_thread_id;
28: #define BAD_THREAD NULL
29:
1.1.1.2 ! root 30: STATIC_INLINE int uae_start_thread (void *(*f) (void *), void *arg, uae_thread_id *thread)
1.1 root 31: {
1.1.1.2 ! root 32: *thread = SDL_CreateThread ((int (*)(void *))f, arg);
! 33: return *thread == 0;
1.1 root 34: }
35:
36: /* Do nothing; thread exits if thread function returns. */
37: #define UAE_THREAD_EXIT do {} while (0)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.