Changeset 109 in libcf for trunk/src/cf_log.c


Ignore:
Timestamp:
06/04/13 14:25:10 (11 years ago)
Author:
cheese
Message:

#1 add typical data structure algorithms (linked-list / queue / stak) and rename symbol for context of each modules

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/cf_log.c

    r108 r109  
    5757#define LOG_DATETIME_LENGTH             sizeof ("0000-00-00 00:00:00.000") - 1
    5858
    59 /**
    60  * 로그 컨텍스트
    61  *
    62  * @remark change from public to private
    63  */
     59/** 로그 컨텍스트 (Opaque) */
    6460typedef void *  CF_Log_Ctx;
    6561
     
    7571    int sec;
    7672    int usec;
    77 } S_CF_LOG_DATETIME, CF_LOG_DATETIME;
    78 
     73} CF_LOG_DATETIME;
     74
     75/** 로그 컨텍스트 (CF_Log_Ctx의 구현) */
    7976typedef struct __cf_log_ctx__ {
    80     char        path[NAME_LENGTH + 1];
    81     int         fd;
    82     char        * buffer;
    83     size_t      size;   /* entire size of buffer */
    84     size_t      length; /* data length in current */
    85     CF_Mutex    mutex;
    86 } S_CF_LOG_CTX, CF_LOG_CTX;
     77    char            path[NAME_LENGTH + 1];
     78    int             fd;
     79    char            * buffer;
     80    size_t          size;   /* entire size of buffer */
     81    size_t          length; /* data length in current */
     82    CF_Mutex_Ctx    mutex;
     83} CF_LOG_CTX;
    8784
    8885typedef struct __cf_log_array__ {
    8986    CF_Log_Ctx  * ctxPool;
    9087    int         ctxSize;
    91 } S_CF_LOG_ARRAY, CF_LOG_ARRAY;
     88} CF_LOG_ARRAY;
    9289
    9390static CF_LOG_ARRAY gLogArray;
     
    257254    ASSERT_CTX (ctx);
    258255
    259     if (CF_Mutex_Create (&context->mutex) < 0)
     256    if (CF_Mutex_CreateCtx (&context->mutex) < 0)
    260257        return CF_ERROR_LOG_SET_MULTITHREAD;
    261258
     
    279276    ASSERT_CTX (ctx);
    280277
    281     if (CF_Mutex_Destory (&context->mutex) < 0)
     278    if (CF_Mutex_DestoryCtx (&context->mutex) < 0)
    282279        return CF_ERROR_LOG_UNSET_MULTITHREAD;
    283280
     
    371368    CF_File_Close (context->fd);
    372369
    373     CF_Mutex_Destory (&context->mutex);
     370    CF_Mutex_DestoryCtx (&context->mutex);
    374371    context->mutex = NULL;
    375372
     
    409406        if (context == NULL)
    410407        {
    411             result = CF_ERROR_LOG_ALLOCATE_CTX;
     408            result = CF_ERROR_LOG_CREATE_CTX;
    412409            TRY_BREAK;
    413410        }
Note: See TracChangeset for help on using the changeset viewer.