Remove redundant void argument list in function def
[openal-soft.git] / common / threads.h
blob8a640390029da92de9f0533f6fb208e4cd24c170
1 #ifndef AL_THREADS_H
2 #define AL_THREADS_H
4 #include <time.h>
6 #include <mutex>
8 #if defined(__GNUC__) && defined(__i386__)
9 /* force_align_arg_pointer is required for proper function arguments aligning
10 * when SSE code is used. Some systems (Windows, QNX) do not guarantee our
11 * thread functions will be properly aligned on the stack, even though GCC may
12 * generate code with the assumption that it is. */
13 #define FORCE_ALIGN __attribute__((force_align_arg_pointer))
14 #else
15 #define FORCE_ALIGN
16 #endif
18 #ifdef _WIN32
19 #define WIN32_LEAN_AND_MEAN
20 #include <windows.h>
21 #elif defined(__APPLE__)
22 #include <dispatch/dispatch.h>
23 #else
24 #include <semaphore.h>
25 #endif
27 void althrd_setname(const char *name);
29 namespace al {
31 class semaphore {
32 #ifdef _WIN32
33 using native_type = HANDLE;
34 #elif defined(__APPLE__)
35 using native_type = dispatch_semaphore_t;
36 #else
37 using native_type = sem_t;
38 #endif
39 native_type mSem;
41 public:
42 semaphore(unsigned int initial=0);
43 semaphore(const semaphore&) = delete;
44 ~semaphore();
46 semaphore& operator=(const semaphore&) = delete;
48 void post();
49 void wait() noexcept;
50 bool try_wait() noexcept;
53 } // namespace al
55 #endif /* AL_THREADS_H */