Ignore:
Timestamp:
Nov 6, 2015 4:18:46 AM (6 years ago)
Author:
nanang
Message:

Close #1894: Improve ioqueue performance on multithreadeded environment.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/include/pj/ioqueue.h

    r4724 r5194  
    304304#endif 
    305305 
     306 
     307/** 
     308 * This macro specifies the maximum event candidates collected by each 
     309 * polling thread to be able to reach maximum number of processed events 
     310 * (i.e: PJ_IOQUEUE_MAX_EVENTS_IN_SINGLE_POLL) in each poll cycle. 
     311 * An event candidate will be dispatched to application as event unless 
     312 * it is already being dispatched by other polling thread. So in order to 
     313 * anticipate such race condition, each poll operation should collects its 
     314 * event candidates more than PJ_IOQUEUE_MAX_EVENTS_IN_SINGLE_POLL, the 
     315 * recommended value is (PJ_IOQUEUE_MAX_EVENTS_IN_SINGLE_POLL * 
     316 * number of polling threads). 
     317 * 
     318 * The value is only meaningfull when specified during PJLIB build and 
     319 * is only effective on multiple polling threads environment. 
     320 */ 
     321#if !defined(PJ_IOQUEUE_MAX_CAND_EVENTS) || \ 
     322    PJ_IOQUEUE_MAX_CAND_EVENTS < PJ_IOQUEUE_MAX_EVENTS_IN_SINGLE_POLL 
     323#   undef  PJ_IOQUEUE_MAX_CAND_EVENTS 
     324#   define PJ_IOQUEUE_MAX_CAND_EVENTS   PJ_IOQUEUE_MAX_EVENTS_IN_SINGLE_POLL 
     325#endif 
     326 
     327 
    306328/** 
    307329 * When this flag is specified in ioqueue's recv() or send() operations, 
     
    503525 */ 
    504526PJ_DECL(pj_status_t) pj_ioqueue_lock_key(pj_ioqueue_key_t *key); 
     527 
     528/** 
     529 * Try to acquire the key's mutex. When the key's concurrency is disabled,  
     530 * application may call this function to synchronize its operation 
     531 * with the key's callback. 
     532 * 
     533 * @param key       The key that was previously obtained from registration. 
     534 * 
     535 * @return          PJ_SUCCESS on success or the appropriate error code. 
     536 */ 
     537PJ_DECL(pj_status_t) pj_ioqueue_trylock_key(pj_ioqueue_key_t *key); 
    505538 
    506539/** 
Note: See TracChangeset for help on using the changeset viewer.