Ignore:
Timestamp:
Aug 30, 2016 8:40:18 AM (5 years ago)
Author:
riza
Message:

Re #1959: Add reference counter to pjsip_inv_session to avoid race condition.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsip-ua/sip_inv.h

    r5109 r5435  
    384384 * that the flip-flop pool's lifetimes are synchronized to the 
    385385 * SDP offer-answer negotiation. 
     386 * 
     387 * The lifetime of this session is controlled by the reference counter in this 
     388 * structure, which is manipulated by calling #pjsip_inv_add_ref and 
     389 * #pjsip_inv_dec_ref. When the reference counter has reached zero, then 
     390 * this session will be destroyed. 
    386391 */ 
    387392struct pjsip_inv_session 
     
    413418    pj_bool_t            following_fork;            /**< Internal, following 
    414419                                                         forked media?      */ 
     420    pj_atomic_t         *ref_cnt;                   /**< Reference counter. */ 
    415421}; 
    416422 
     
    629635                                          unsigned options, 
    630636                                          pjsip_inv_session **p_inv); 
     637 
     638 
     639/** 
     640 * Add reference counter to the INVITE session. The reference counter controls 
     641 * the life time of the session, ie. when the counter reaches zero, then it  
     642 * will be destroyed. 
     643 * 
     644 * @param inv       The INVITE session. 
     645 * @return          PJ_SUCCESS if the INVITE session reference counter 
     646 *                  was increased. 
     647 */ 
     648PJ_DECL(pj_status_t) pjsip_inv_add_ref( pjsip_inv_session *inv ); 
     649 
     650/** 
     651 * Decrement reference counter of the INVITE session. 
     652 * When the session is no longer used, it will be destroyed and 
     653 * caller is informed with PJ_EGONE return status. 
     654 * 
     655 * @param inv       The INVITE session. 
     656 * @return          PJ_SUCCESS if the INVITE session reference counter 
     657 *                  was decreased. A status PJ_EGONE will be returned to  
     658 *                  inform that session is destroyed. 
     659 */ 
     660PJ_DECL(pj_status_t) pjsip_inv_dec_ref( pjsip_inv_session *inv ); 
    631661 
    632662 
Note: See TracChangeset for help on using the changeset viewer.