Changeset 672


Ignore:
Timestamp:
Aug 11, 2006 12:42:06 PM (16 years ago)
Author:
bennylp
Message:

Increased width for sender column in log message, and added additional check in pj_thread_register()

Location:
pjproject/trunk/pjlib/src/pj
Files:
2 edited

Legend:

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

    r522 r672  
    116116    } 
    117117    if (log_decor & PJ_LOG_HAS_SENDER) { 
    118         enum { SENDER_WIDTH = 12 }; 
     118        enum { SENDER_WIDTH = 14 }; 
    119119        int sender_len = strlen(sender); 
    120120        *pre++ = ' '; 
  • pjproject/trunk/pjlib/src/pj/os_core_unix.c

    r635 r672  
    4444#define THIS_FILE   "os_core_unix.c" 
    4545 
     46#define SIGNATURE1  0xDEAFBEEF 
     47#define SIGNATURE2  0xDEADC0DE 
     48 
    4649struct pj_thread_t 
    4750{ 
     
    5053    pj_thread_proc *proc; 
    5154    void           *arg; 
     55    pj_uint32_t     signature1; 
     56    pj_uint32_t     signature2; 
    5257 
    5358    pj_mutex_t     *suspended_mutex; 
     
    193198    } 
    194199 
    195     /* If a thread descriptor has been registered before, just return it. */ 
     200    /* Warn if this thread has been registered before */ 
    196201    if (pj_thread_local_get (thread_tls_id) != 0) { 
    197202        // 2006-02-26 bennylp: 
     
    206211    } 
    207212 
     213    /* On the other hand, also warn if the thread descriptor buffer seem to 
     214     * have been used to register other threads. 
     215     */ 
     216    pj_assert(thread->signature1 != SIGNATURE1 || 
     217              thread->signature2 != SIGNATURE2 || 
     218              (thread->thread == pthread_self())); 
     219 
    208220    /* Initialize and set the thread entry. */ 
    209221    pj_bzero(desc, sizeof(struct pj_thread_t)); 
    210222    thread->thread = pthread_self(); 
     223    thread->signature1 = SIGNATURE1; 
     224    thread->signature2 = SIGNATURE2; 
    211225 
    212226    if(cstr_thread_name && pj_strlen(&thread_name) < sizeof(thread->obj_name)-1) 
     
    218232     
    219233    rc = pj_thread_local_set(thread_tls_id, thread); 
    220     if (rc != PJ_SUCCESS) 
     234    if (rc != PJ_SUCCESS) { 
     235        pj_bzero(desc, sizeof(struct pj_thread_t)); 
    221236        return rc; 
     237    } 
    222238 
    223239#if defined(PJ_OS_HAS_CHECK_STACK) && PJ_OS_HAS_CHECK_STACK!=0 
Note: See TracChangeset for help on using the changeset viewer.