Replace all #ifdef with #if defined (...) for convention

This commit is contained in:
jsteube
2016-09-07 22:29:57 +02:00
parent eb00cd959f
commit 9eb47153d4
37 changed files with 182 additions and 170 deletions
+6 -6
View File
@@ -6,23 +6,23 @@
#ifndef _THREAD_H
#define _THREAD_H
#ifdef _POSIX
#if defined (_POSIX)
#include <pthread.h>
#include <semaphore.h>
#endif // _POSIX
#ifdef _WIN
#if defined (_WIN)
#include <windows.h>
#endif // _WIN
#ifdef _WIN
#if defined (_WIN)
typedef HANDLE hc_thread_t;
typedef CRITICAL_SECTION hc_thread_mutex_t;
#elif _POSIX
#elif defined (_POSIX)
typedef pthread_t hc_thread_t;
typedef pthread_mutex_t hc_thread_mutex_t;
#endif
#ifdef _WIN
#if defined (_WIN)
#define hc_thread_create(t,f,a) t = CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE) &f, a, 0, NULL)
#define hc_thread_wait(n,a) for (uint i = 0; i < n; i++) WaitForSingleObject ((a)[i], INFINITE)
@@ -33,7 +33,7 @@ typedef pthread_mutex_t hc_thread_mutex_t;
#define hc_thread_mutex_init(m) InitializeCriticalSection (&m)
#define hc_thread_mutex_delete(m) DeleteCriticalSection (&m)
#elif _POSIX
#elif defined (_POSIX)
#define hc_thread_create(t,f,a) pthread_create (&t, NULL, f, a)
#define hc_thread_wait(n,a) for (uint i = 0; i < n; i++) pthread_join ((a)[i], NULL)