Changeset 5194 for pjproject/trunk/pjlib/src/pj/ioqueue_common_abs.c
- Timestamp:
- Nov 6, 2015 4:18:46 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pj/ioqueue_common_abs.c
r4890 r5194 196 196 * framework. 197 197 */ 198 void ioqueue_dispatch_write_event(pj_ioqueue_t *ioqueue, pj_ioqueue_key_t *h) 199 { 200 /* Lock the key. */ 201 pj_ioqueue_lock_key(h); 198 pj_bool_t ioqueue_dispatch_write_event( pj_ioqueue_t *ioqueue, 199 pj_ioqueue_key_t *h) 200 { 201 pj_status_t rc; 202 203 /* Try lock the key. */ 204 rc = pj_ioqueue_trylock_key(h); 205 if (rc != PJ_SUCCESS) { 206 return PJ_FALSE; 207 } 202 208 203 209 if (IS_CLOSING(h)) { 204 210 pj_ioqueue_unlock_key(h); 205 return ;211 return PJ_TRUE; 206 212 } 207 213 … … 418 424 */ 419 425 pj_ioqueue_unlock_key(h); 420 } 421 } 422 423 void ioqueue_dispatch_read_event( pj_ioqueue_t *ioqueue, pj_ioqueue_key_t *h ) 426 427 return PJ_FALSE; 428 } 429 430 return PJ_TRUE; 431 } 432 433 pj_bool_t ioqueue_dispatch_read_event( pj_ioqueue_t *ioqueue, 434 pj_ioqueue_key_t *h ) 424 435 { 425 436 pj_status_t rc; 426 437 427 /* Lock the key. */ 428 pj_ioqueue_lock_key(h); 438 /* Try lock the key. */ 439 rc = pj_ioqueue_trylock_key(h); 440 if (rc != PJ_SUCCESS) { 441 return PJ_FALSE; 442 } 429 443 430 444 if (IS_CLOSING(h)) { 431 445 pj_ioqueue_unlock_key(h); 432 return ;446 return PJ_TRUE; 433 447 } 434 448 … … 605 619 */ 606 620 pj_ioqueue_unlock_key(h); 607 } 608 } 609 610 611 void ioqueue_dispatch_exception_event( pj_ioqueue_t *ioqueue, 612 pj_ioqueue_key_t *h ) 621 622 return PJ_FALSE; 623 } 624 625 return PJ_TRUE; 626 } 627 628 629 pj_bool_t ioqueue_dispatch_exception_event( pj_ioqueue_t *ioqueue, 630 pj_ioqueue_key_t *h ) 613 631 { 614 632 pj_bool_t has_lock; 615 616 pj_ioqueue_lock_key(h); 633 pj_status_t rc; 634 635 /* Try lock the key. */ 636 rc = pj_ioqueue_trylock_key(h); 637 if (rc != PJ_SUCCESS) { 638 return PJ_FALSE; 639 } 617 640 618 641 if (!h->connecting) { … … 622 645 */ 623 646 pj_ioqueue_unlock_key(h); 624 return;647 return PJ_TRUE; 625 648 } 626 649 627 650 if (IS_CLOSING(h)) { 628 651 pj_ioqueue_unlock_key(h); 629 return ;652 return PJ_TRUE; 630 653 } 631 654 … … 669 692 pj_ioqueue_unlock_key(h); 670 693 } 694 695 return PJ_TRUE; 671 696 } 672 697 … … 1325 1350 } 1326 1351 1352 PJ_DEF(pj_status_t) pj_ioqueue_trylock_key(pj_ioqueue_key_t *key) 1353 { 1354 if (key->grp_lock) 1355 return pj_grp_lock_tryacquire(key->grp_lock); 1356 else 1357 return pj_lock_tryacquire(key->lock); 1358 } 1359 1327 1360 PJ_DEF(pj_status_t) pj_ioqueue_unlock_key(pj_ioqueue_key_t *key) 1328 1361 {
Note: See TracChangeset
for help on using the changeset viewer.