Changeset 675


Ignore:
Timestamp:
Aug 12, 2006 1:58:56 PM (18 years ago)
Author:
bennylp
Message:

Improved logging consistency and added more logging info in verbosity 6

Location:
pjproject/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pj/os_core_unix.c

    r674 r675  
    8080    int                 nesting_level; 
    8181    pj_thread_t        *owner; 
     82    char                owner_name[PJ_MAX_OBJ_NAME]; 
    8283#endif 
    8384}; 
     
    979980    PJ_ASSERT_RETURN(mutex, PJ_EINVAL); 
    980981 
     982#if PJ_DEBUG 
     983    PJ_LOG(6,(mutex->obj_name, "Mutex: thread %s is waiting (mutex owner=%s)",  
     984                                pj_thread_this()->obj_name, 
     985                                mutex->owner_name)); 
     986#else 
    981987    PJ_LOG(6,(mutex->obj_name, "Mutex: thread %s is waiting",  
    982988                                pj_thread_this()->obj_name)); 
     989#endif 
    983990 
    984991    status = pthread_mutex_lock( &mutex->mutex ); 
    985992 
     993 
     994#if PJ_DEBUG 
     995    if (status == PJ_SUCCESS) { 
     996        mutex->owner = pj_thread_this(); 
     997        pj_ansi_strcpy(mutex->owner_name, mutex->owner->obj_name); 
     998        ++mutex->nesting_level; 
     999    } 
     1000 
     1001    PJ_LOG(6,(mutex->obj_name,  
     1002              (status==0 ?  
     1003                "Mutex acquired by thread %s (level=%d)" :  
     1004                "Mutex acquisition FAILED by %s (level=%d)"), 
     1005              pj_thread_this()->obj_name, 
     1006              mutex->nesting_level)); 
     1007#else 
    9861008    PJ_LOG(6,(mutex->obj_name,  
    9871009              (status==0 ? "Mutex acquired by thread %s" : "FAILED by %s"), 
    9881010              pj_thread_this()->obj_name)); 
    989  
    990 #if PJ_DEBUG 
    991     if (status == PJ_SUCCESS) { 
    992         mutex->owner = pj_thread_this(); 
    993         ++mutex->nesting_level; 
    994     } 
    9951011#endif 
    9961012 
     
    10201036    if (--mutex->nesting_level == 0) { 
    10211037        mutex->owner = NULL; 
    1022     } 
    1023 #endif 
    1024  
     1038        mutex->owner_name[0] = '\0'; 
     1039    } 
     1040 
     1041    PJ_LOG(6,(mutex->obj_name, "Mutex released by thread %s (level=%d)",  
     1042                                pj_thread_this()->obj_name,  
     1043                                mutex->nesting_level)); 
     1044#else 
    10251045    PJ_LOG(6,(mutex->obj_name, "Mutex released by thread %s",  
    10261046                                pj_thread_this()->obj_name)); 
     1047#endif 
    10271048 
    10281049    status = pthread_mutex_unlock( &mutex->mutex ); 
     
    10521073 
    10531074    if (status==0) { 
     1075#if PJ_DEBUG 
     1076        mutex->owner = pj_thread_this(); 
     1077        pj_ansi_strcpy(mutex->owner_name, mutex->owner->obj_name); 
     1078        ++mutex->nesting_level; 
     1079 
     1080        PJ_LOG(6,(mutex->obj_name, "Mutex acquired by thread %s (level=%d)",  
     1081                                   pj_thread_this()->obj_name, 
     1082                                   mutex->nesting_level)); 
     1083#else 
    10541084        PJ_LOG(6,(mutex->obj_name, "Mutex acquired by thread %s",  
    10551085                                  pj_thread_this()->obj_name)); 
    1056  
    1057 #if PJ_DEBUG 
    1058         mutex->owner = pj_thread_this(); 
    1059         ++mutex->nesting_level; 
    10601086#endif 
    10611087    } 
     
    10821108 
    10831109#if PJ_HAS_THREADS 
    1084     PJ_LOG(6,(mutex->obj_name, "Mutex destroyed")); 
     1110    PJ_LOG(6,(mutex->obj_name, "Mutex destroyed by thread %s", 
     1111                               pj_thread_this()->obj_name)); 
    10851112    status = pthread_mutex_destroy( &mutex->mutex ); 
    10861113    if (status == 0) 
  • pjproject/trunk/pjsip/src/pjsip/sip_dialog.c

    r673 r675  
    8181    pj_list_init(&dlg->inv_hdr); 
    8282 
    83     status = pj_mutex_create_recursive(pool, "dlg%p", &dlg->mutex_); 
     83    status = pj_mutex_create_recursive(pool, dlg->obj_name, &dlg->mutex_); 
    8484    if (status != PJ_SUCCESS) 
    8585        goto on_error; 
  • pjproject/trunk/pjsip/src/pjsip/sip_transaction.c

    r657 r675  
    906906    tsx->timeout_timer.cb = &tsx_timer_callback; 
    907907     
    908     status = pj_mutex_create_recursive(pool, "tsx%p", &tsx->mutex); 
     908    status = pj_mutex_create_recursive(pool, tsx->obj_name, &tsx->mutex); 
    909909    if (status != PJ_SUCCESS) { 
    910910        pjsip_endpt_release_pool(mod_tsx_layer.endpt, pool); 
Note: See TracChangeset for help on using the changeset viewer.