Changeset 151 in libcf for trunk/src/cf_mutex.c


Ignore:
Timestamp:
10/31/13 10:17:24 (11 years ago)
Author:
cheese
Message:

#1 fix interface and add util module

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/cf_mutex.c

    r149 r151  
    2121#endif // #if defined(_WIN32) || defined(_WIN64)
    2222
    23 #define ASSERT_MUTEX_CTX(__ctx) \
    24     if (__ctx == NULL)          \
     23#define ASSERT_CTX(__ctx)   \
     24    if (__ctx == NULL)      \
    2525        return CF_ERROR_MUTEX_INVALID_CTX
    2626
     
    3838 */
    3939int
    40 CF_Mutex_CreateCtx (CF_Mutex_Ctx * ctx)
     40CF_Mutex_Create (cf_ctx * ctx)
    4141{
    4242    int result = 0;
     
    4444    CF_MUTEX_CONTEXT * context = NULL;
    4545
    46     context = (CF_MUTEX_CONTEXT *) calloc (sizeof (CF_MUTEX_CONTEXT), 1);
     46    ASSERT_CTX (ctx);
     47
     48    context = NEWCTX (CF_MUTEX_CONTEXT);
    4749    if (context == NULL)
    4850        return CF_ERROR_MUTEX_CREATE_CTX;
     
    7072    CATCH_IF (result < 0)
    7173    {
    72         CF_Mutex_DestoryCtx ((CF_Mutex_Ctx) context);
     74        CF_Mutex_Destory ((cf_ctx) context);
    7375    }
    7476
     
    8486 */
    8587int
    86 CF_Mutex_DestoryCtx (CF_Mutex_Ctx ctx)
     88CF_Mutex_Destory (cf_ctx ctx)
    8789{
    88     CF_MUTEX_CONTEXT * context = ctx;
     90    CF_MUTEX_CONTEXT * context = (CF_MUTEX_CONTEXT *) ctx;
    8991
    90     ASSERT_MUTEX_CTX (ctx);
     92    ASSERT_CTX (ctx);
    9193
    9294#if defined(_WIN32) || defined(_WIN64)
     
    112114 */
    113115int
    114 CF_Mutex_Lock (CF_Mutex_Ctx ctx)
     116CF_Mutex_Lock (cf_ctx ctx)
    115117{
    116     CF_MUTEX_CONTEXT * context = ctx;
     118    CF_MUTEX_CONTEXT * context = (CF_MUTEX_CONTEXT *) ctx;
    117119
    118     ASSERT_MUTEX_CTX (ctx);
     120    ASSERT_CTX (ctx);
    119121
    120122#if defined(_WIN32) || defined(_WIN64)
     
    135137 */
    136138int
    137 CF_Mutex_Unlock (CF_Mutex_Ctx ctx)
     139CF_Mutex_Unlock (cf_ctx ctx)
    138140{
    139     CF_MUTEX_CONTEXT * context = ctx;
     141    CF_MUTEX_CONTEXT * context = (CF_MUTEX_CONTEXT *) ctx;
    140142
    141     ASSERT_MUTEX_CTX (ctx);
     143    ASSERT_CTX (ctx);
    142144
    143145#if defined(_WIN32) || defined(_WIN64)
Note: See TracChangeset for help on using the changeset viewer.