Changeset 5829
- Timestamp:
- Jul 20, 2018 7:21:32 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pj/lock.c
r4992 r5829 557 557 } 558 558 pj_assert(cnt > 0); 559 pj_grp_lock_dump(glock); 560 return PJ_SUCCESS; 559 return PJ_SUCCESS; 560 } 561 562 static pj_status_t grp_lock_dec_ref_dump(pj_grp_lock_t *glock) 563 { 564 pj_status_t status; 565 566 status = grp_lock_dec_ref(glock); 567 if (status == PJ_SUCCESS) { 568 pj_grp_lock_dump(glock); 569 } else if (status == PJ_EGONE) { 570 PJ_LOG(4,(THIS_FILE, "Group lock %p destroyed.", glock)); 571 } 572 573 return status; 561 574 } 562 575 … … 600 613 { 601 614 grp_lock_ref *ref; 615 616 PJ_UNUSED_ARG(line); 602 617 603 618 pj_enter_critical_section(); … … 619 634 } 620 635 621 return grp_lock_dec_ref (glock);636 return grp_lock_dec_ref_dump(glock); 622 637 } 623 638 #else … … 696 711 { 697 712 #if PJ_GRP_LOCK_DEBUG 698 grp_lock_ref *ref = grp_lock->ref_list.next;713 grp_lock_ref *ref; 699 714 char info_buf[1000]; 700 715 pj_str_t info; … … 703 718 info.slen = 0; 704 719 705 pj_grp_lock_acquire(grp_lock);720 grp_lock_add_ref(grp_lock); 706 721 pj_enter_critical_section(); 707 722 723 ref = grp_lock->ref_list.next; 708 724 while (ref != &grp_lock->ref_list && info.slen < sizeof(info_buf)) { 709 725 char *start = info.ptr + info.slen; … … 711 727 int len; 712 728 713 len = pj_ansi_snprintf(start, max_len, " %s:%d", ref->file, ref->line);729 len = pj_ansi_snprintf(start, max_len, "\t%s:%d\n", ref->file, ref->line); 714 730 if (len < 1 || len >= max_len) { 715 731 len = strlen(ref->file); … … 718 734 719 735 memcpy(start, ref->file, len); 720 start[len++] = ' 736 start[len++] = '\n'; 721 737 } 722 738 … … 734 750 735 751 pj_leave_critical_section(); 736 pj_grp_lock_release(grp_lock); 737 738 PJ_LOG(4,(THIS_FILE, "Group lock %p, ref_cnt=%d. Reference holders: %s", 739 grp_lock, pj_grp_lock_get_ref(grp_lock), info.ptr)); 752 753 PJ_LOG(4,(THIS_FILE, "Group lock %p, ref_cnt=%d. Reference holders:\n%s", 754 grp_lock, pj_grp_lock_get_ref(grp_lock)-1, info.ptr)); 755 756 grp_lock_dec_ref(grp_lock); 740 757 #else 741 PJ_UNUSED_ARG(grp_lock); 758 PJ_LOG(4,(THIS_FILE, "Group lock %p, ref_cnt=%d.", 759 grp_lock, pj_grp_lock_get_ref(grp_lock))); 742 760 #endif 743 761 }
Note: See TracChangeset
for help on using the changeset viewer.