Changeset 4992 for pjproject/trunk/pjlib/src/pj/lock.c
- Timestamp:
- Mar 6, 2015 6:09:22 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pj/lock.c
r4613 r4992 336 336 } 337 337 338 static pj_status_t grp_lock_add_handler( pj_grp_lock_t *glock, 339 pj_pool_t *pool, 340 void *comp, 341 void (*destroy)(void *comp), 342 pj_bool_t acquire_lock) 343 { 344 grp_destroy_callback *cb; 345 346 if (acquire_lock) 347 grp_lock_acquire(glock); 348 349 if (pool == NULL) 350 pool = glock->pool; 351 352 cb = PJ_POOL_ZALLOC_T(pool, grp_destroy_callback); 353 cb->comp = comp; 354 cb->handler = destroy; 355 pj_list_push_back(&glock->destroy_list, cb); 356 357 if (acquire_lock) 358 grp_lock_release(glock); 359 360 return PJ_SUCCESS; 361 } 362 338 363 static pj_status_t grp_lock_destroy(LOCK_OBJ *p) 339 364 { … … 428 453 } 429 454 455 PJ_DEF(pj_status_t) pj_grp_lock_create_w_handler( pj_pool_t *pool, 456 const pj_grp_lock_config *cfg, 457 void *member, 458 void (*handler)(void *member), 459 pj_grp_lock_t **p_grp_lock) 460 { 461 pj_status_t status; 462 463 status = pj_grp_lock_create(pool, cfg, p_grp_lock); 464 if (status == PJ_SUCCESS) { 465 grp_lock_add_handler(*p_grp_lock, pool, member, handler, PJ_FALSE); 466 } 467 468 return status; 469 } 470 430 471 PJ_DEF(pj_status_t) pj_grp_lock_destroy( pj_grp_lock_t *grp_lock) 431 472 { … … 477 518 void (*destroy)(void *comp)) 478 519 { 479 grp_destroy_callback *cb; 480 481 grp_lock_acquire(glock); 482 483 if (pool == NULL) 484 pool = glock->pool; 485 486 cb = PJ_POOL_ZALLOC_T(pool, grp_destroy_callback); 487 cb->comp = comp; 488 cb->handler = destroy; 489 pj_list_push_back(&glock->destroy_list, cb); 490 491 grp_lock_release(glock); 492 return PJ_SUCCESS; 520 return grp_lock_add_handler(glock, pool, comp, destroy, PJ_TRUE); 493 521 } 494 522
Note: See TracChangeset
for help on using the changeset viewer.