Changeset 675 for pjproject/trunk/pjlib/src/pj/os_core_unix.c
- Timestamp:
- Aug 12, 2006 1:58:56 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pj/os_core_unix.c
r674 r675 80 80 int nesting_level; 81 81 pj_thread_t *owner; 82 char owner_name[PJ_MAX_OBJ_NAME]; 82 83 #endif 83 84 }; … … 979 980 PJ_ASSERT_RETURN(mutex, PJ_EINVAL); 980 981 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 981 987 PJ_LOG(6,(mutex->obj_name, "Mutex: thread %s is waiting", 982 988 pj_thread_this()->obj_name)); 989 #endif 983 990 984 991 status = pthread_mutex_lock( &mutex->mutex ); 985 992 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 986 1008 PJ_LOG(6,(mutex->obj_name, 987 1009 (status==0 ? "Mutex acquired by thread %s" : "FAILED by %s"), 988 1010 pj_thread_this()->obj_name)); 989 990 #if PJ_DEBUG991 if (status == PJ_SUCCESS) {992 mutex->owner = pj_thread_this();993 ++mutex->nesting_level;994 }995 1011 #endif 996 1012 … … 1020 1036 if (--mutex->nesting_level == 0) { 1021 1037 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 1025 1045 PJ_LOG(6,(mutex->obj_name, "Mutex released by thread %s", 1026 1046 pj_thread_this()->obj_name)); 1047 #endif 1027 1048 1028 1049 status = pthread_mutex_unlock( &mutex->mutex ); … … 1052 1073 1053 1074 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 1054 1084 PJ_LOG(6,(mutex->obj_name, "Mutex acquired by thread %s", 1055 1085 pj_thread_this()->obj_name)); 1056 1057 #if PJ_DEBUG1058 mutex->owner = pj_thread_this();1059 ++mutex->nesting_level;1060 1086 #endif 1061 1087 } … … 1082 1108 1083 1109 #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)); 1085 1112 status = pthread_mutex_destroy( &mutex->mutex ); 1086 1113 if (status == 0)
Note: See TracChangeset
for help on using the changeset viewer.