diff options
Diffstat (limited to 'src/include/platform_interface.h')
-rw-r--r-- | src/include/platform_interface.h | 108 |
1 files changed, 0 insertions, 108 deletions
diff --git a/src/include/platform_interface.h b/src/include/platform_interface.h index 13f54530..c2aee64b 100644 --- a/src/include/platform_interface.h +++ b/src/include/platform_interface.h @@ -189,113 +189,5 @@ typedef int _MHD_socket_funcs_size; #else #define MHD_random_() MHD_W32_random_() #endif -#if defined(MHD_USE_W32_THREADS) -#define MHD_W32_MUTEX_ 1 -#include <windows.h> -typedef CRITICAL_SECTION MHD_mutex_; -#elif defined(HAVE_PTHREAD_H) && defined(MHD_USE_POSIX_THREADS) -#define MHD_PTHREAD_MUTEX_ 1 -typedef pthread_mutex_t MHD_mutex_; -#else -#error "No base mutex API is available." -#endif - -#if defined(MHD_PTHREAD_MUTEX_) -/** - * Create new mutex. - * @param mutex pointer to the mutex - * @return #MHD_YES on success, #MHD_NO on failure - */ -#define MHD_mutex_create_(mutex) \ - ((0 == pthread_mutex_init ((mutex), NULL)) ? MHD_YES : MHD_NO) -#elif defined(MHD_W32_MUTEX_) -/** - * Create new mutex. - * @param mutex pointer to mutex - * @return #MHD_YES on success, #MHD_NO on failure - */ -#define MHD_mutex_create_(mutex) \ - ((NULL != (mutex) && 0 != InitializeCriticalSectionAndSpinCount((mutex),2000)) ? MHD_YES : MHD_NO) -#endif - -#if defined(MHD_PTHREAD_MUTEX_) -/** - * Destroy previously created mutex. - * @param mutex pointer to mutex - * @return #MHD_YES on success, #MHD_NO on failure - */ -#define MHD_mutex_destroy_(mutex) \ - ((0 == pthread_mutex_destroy ((mutex))) ? MHD_YES : MHD_NO) -#elif defined(MHD_W32_MUTEX_) -/** - * Destroy previously created mutex. - * @param mutex pointer to mutex - * @return #MHD_YES on success, #MHD_NO on failure - */ -#define MHD_mutex_destroy_(mutex) \ - ((NULL != (mutex)) ? (DeleteCriticalSection(mutex), MHD_YES) : MHD_NO) -#endif - -#if defined(MHD_PTHREAD_MUTEX_) -/** - * Acquire lock on previously created mutex. - * If mutex was already locked by other thread, function - * blocks until mutex becomes available. - * @param mutex pointer to mutex - * @return #MHD_YES on success, #MHD_NO on failure - */ -#define MHD_mutex_lock_(mutex) \ - ((0 == pthread_mutex_lock((mutex))) ? MHD_YES : MHD_NO) -#elif defined(MHD_W32_MUTEX_) -/** - * Acquire lock on previously created mutex. - * If mutex was already locked by other thread, function - * blocks until mutex becomes available. - * @param mutex pointer to mutex - * @return #MHD_YES on success, #MHD_NO on failure - */ -#define MHD_mutex_lock_(mutex) \ - ((NULL != (mutex)) ? (EnterCriticalSection((mutex)), MHD_YES) : MHD_NO) -#endif - -#if defined(MHD_PTHREAD_MUTEX_) -/** - * Try to acquire lock on previously created mutex. - * Function returns immediately. - * @param mutex pointer to mutex - * @return #MHD_YES if mutex is locked, #MHD_NO if - * mutex was not locked. - */ -#define MHD_mutex_trylock_(mutex) \ - ((0 == pthread_mutex_trylock((mutex))) ? MHD_YES : MHD_NO) -#elif defined(MHD_W32_MUTEX_) -/** - * Try to acquire lock on previously created mutex. - * Function returns immediately. - * @param mutex pointer to mutex - * @return #MHD_YES if mutex is locked, #MHD_NO if - * mutex was not locked. - */ -#define MHD_mutex_trylock_(mutex) \ - ((NULL != (mutex) && 0 != TryEnterCriticalSection ((mutex))) ? MHD_YES : MHD_NO) -#endif - -#if defined(MHD_PTHREAD_MUTEX_) -/** - * Unlock previously created and locked mutex. - * @param mutex pointer to mutex - * @return #MHD_YES on success, #MHD_NO on failure - */ -#define MHD_mutex_unlock_(mutex) \ - ((0 == pthread_mutex_unlock((mutex))) ? MHD_YES : MHD_NO) -#elif defined(MHD_W32_MUTEX_) -/** - * Unlock previously created and locked mutex. - * @param mutex pointer to mutex - * @return #MHD_YES on success, #MHD_NO on failure - */ -#define MHD_mutex_unlock_(mutex) \ - ((NULL != (mutex)) ? (LeaveCriticalSection((mutex)), MHD_YES) : MHD_NO) -#endif #endif /* MHD_PLATFORM_INTERFACE_H */ |