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


Ignore:
Timestamp:
06/12/13 11:05:07 (11 years ago)
Author:
cheese
Message:

#1 modify id to context in thread

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/cf_log.c

    r119 r122  
    5252        return CF_ERROR_LOG_NOT_MAPPED_ID
    5353
    54 #define LOCK_LOG_CTX(__ctx)             CF_Mutex_Lock (&__ctx->mutex)
    55 #define UNLOCK_LOG_CTX(__ctx)           CF_Mutex_Unlock (&__ctx->mutex)
     54#define LOCK_LOG_CTX(__ctx)             CF_Mutex_Lock (__ctx->mutex)
     55#define UNLOCK_LOG_CTX(__ctx)           CF_Mutex_Unlock (__ctx->mutex)
    5656
    5757#define LOG_BUFFER_DEFAULT_SIZE         128 * 1024
     
    7676
    7777/** 로그 컨텍스트 (CF_Log_Ctx의 구현) */
    78 typedef struct __cf_log_ctx__ {
     78typedef struct __cf_log_ctx__
     79{
    7980    char            path[NAME_LENGTH + 1];
    8081    int             fd;
     
    8586} CF_LOG_CTX;
    8687
    87 typedef struct __cf_log_array__ {
     88typedef struct __cf_log_array__
     89{
    8890    CF_Log_Ctx  * ctxPool;
    8991    int         ctxSize;
     
    278280    ASSERT_CTX (ctx);
    279281
    280     if (CF_Mutex_DestoryCtx (&context->mutex) < 0)
     282    if (CF_Mutex_DestoryCtx (context->mutex) < 0)
    281283        return CF_ERROR_LOG_UNSET_MULTITHREAD;
     284
     285    context->mutex = NULL;
    282286
    283287    return CF_OK;
     
    370374    CF_File_Close (context->fd);
    371375
    372     CF_Mutex_DestoryCtx (&context->mutex);
     376    CF_Mutex_DestoryCtx (context->mutex);
    373377    context->mutex = NULL;
    374378
     
    381385 * \return 성공 시, 로그 컨텍스트; 실패 시, NULL
    382386 *
     387 * \param ctx       로그 컨텍스트 주소
    383388 * \param path      로그 파일 경로
    384389 * \param memsize   로그 버퍼 크기
    385  * \param ctx       로그 컨텍스트 받을 주소
    386390 *
    387391 * \see CF_LOG_DEFAULT_BUFFER, CF_LOG_NO_BUFFER
    388392 */
    389393static int
    390 CF_Log_CreateCtx (const char    * path,
    391                   const int     memsize,
    392                   CF_Log_Ctx    * ctx)
     394CF_Log_CreateCtx (CF_Log_Ctx    * ctx,
     395                  const char    * path,
     396                  const int     memsize)
    393397{
    394398    int result = 0;
     
    580584    CF_Log_Ctx  ctx = NULL;
    581585
    582     result = CF_Log_CreateCtx (path, memsize, &ctx);
     586    result = CF_Log_CreateCtx (&ctx, path, memsize);
    583587    if (result < 0)
    584588        return result;
Note: See TracChangeset for help on using the changeset viewer.