Changeset 3986 for pjproject/branches/1.x/pjsip/src/pjsip/sip_endpoint.c
- Timestamp:
- Mar 22, 2012 11:29:20 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/1.x/pjsip/src/pjsip/sip_endpoint.c
r3553 r3986 41 41 #define MAX_METHODS 32 42 42 43 44 /* List of SIP endpoint exit callback. */ 45 typedef struct exit_cb 46 { 47 PJ_DECL_LIST_MEMBER (struct exit_cb); 48 pjsip_endpt_exit_callback func; 49 } exit_cb; 50 51 43 52 /** 44 53 * The SIP endpoint. … … 87 96 /** Additional request headers. */ 88 97 pjsip_hdr req_hdr; 98 99 /** List of exit callback. */ 100 exit_cb exit_cb_list; 89 101 }; 90 102 … … 446 458 pj_list_init(&endpt->module_list); 447 459 460 /* Initialize exit callback list. */ 461 pj_list_init(&endpt->exit_cb_list); 462 448 463 /* Create R/W mutex for module manipulation. */ 449 464 status = pj_rwmutex_create(endpt->pool, "ept%p", &endpt->mod_mutex); … … 560 575 { 561 576 pjsip_module *mod; 577 exit_cb *ecb; 562 578 563 579 PJ_LOG(5, (THIS_FILE, "Destroying endpoing instance..")); 580 581 /* Call all registered exit callbacks */ 582 ecb = endpt->exit_cb_list.next; 583 while (ecb != &endpt->exit_cb_list) { 584 (*ecb->func)(endpt); 585 ecb = ecb->next; 586 } 564 587 565 588 /* Phase 1: stop all modules */ … … 1179 1202 } 1180 1203 1204 1205 PJ_DEF(pj_status_t) pjsip_endpt_atexit( pjsip_endpoint *endpt, 1206 pjsip_endpt_exit_callback func) 1207 { 1208 exit_cb *new_cb; 1209 1210 PJ_ASSERT_RETURN(endpt && func, PJ_EINVAL); 1211 1212 new_cb = PJ_POOL_ZALLOC_T(endpt->pool, exit_cb); 1213 new_cb->func = func; 1214 1215 pj_mutex_lock(endpt->mutex); 1216 pj_list_push_back(&endpt->exit_cb_list, new_cb); 1217 pj_mutex_unlock(endpt->mutex); 1218 1219 return PJ_SUCCESS; 1220 }
Note: See TracChangeset
for help on using the changeset viewer.