Back to index

im-sdk  12.3.91
SunIMLock.h
Go to the documentation of this file.
00001 #ifndef SUNIMLOCK_H
00002 #define SUNIMLOCK_H
00003 
00004 #ifdef  sun
00005 #   define SUNIM_LOCK(m) \
00006               ((mutex_lock(&m) != 0) && \
00007                (fprintf(stderr, "mutex_lock(): FAILED\n"), 0))
00008 #elif   WIN32
00009 #   define SUNIM_LOCK(m) \
00010               (((WaitForSingleObject(m, INFINITE) == WAIT_FAILED)) && \
00011                printf("WaitForSingleObject(): FAILED\n"))
00012 #else
00013 #   define SUNIM_LOCK(m) \
00014               ((pthread_mutex_lock(&m) != 0) && \
00015                printf("pthread_mutex_lock(): FAILEDK\n"))
00016 #endif
00017 
00018 #ifdef  sun
00019 #   define SUNIM_UNLOCK(m) \
00020               ((mutex_unlock(&m) != 0) && \
00021                (fprintf(stderr, "mutex_unlock(): FAILED\n"), 0))
00022 #elif   WIN32
00023 #   define SUNIM_UNLOCK(m) \
00024               ((ReleaseMutex(m) == 0) && \
00025                printf("ReleaseMutex(): FAILED\n"))
00026 #else
00027 #   define SUNIM_UNLOCK(m) \
00028               ((pthread_mutex_unlock(&m) != 0) && \
00029                printf("pthread_mutex_unlock(): FAILED\n"))
00030 #endif
00031 #endif