Ignore:
Timestamp:
Jul 10, 2019 7:15:08 AM (5 years ago)
Author:
riza
Message:

Close #2211: Use group lock for SIP dialog.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsip/sip_dialog.h

    r5456 r6037  
    142142    char                obj_name[PJ_MAX_OBJ_NAME];  /**< Standard id.       */ 
    143143    pj_pool_t          *pool;       /**< Dialog's pool.                     */ 
    144     pj_mutex_t         *mutex_;     /**< Dialog's mutex. Do not call!! 
    145                                          Use pjsip_dlg_inc_lock() instead!  */ 
    146144    pjsip_user_agent   *ua;         /**< User agent instance.               */ 
    147145    pjsip_endpoint     *endpt;      /**< Endpoint instance.                 */ 
     146    pj_grp_lock_t      *grp_lock_;  /**< Dialog's grp lock. Do not call!! 
     147                                         Use pjsip_dlg_inc_lock() instead!  */ 
    148148 
    149149    /** The dialog set which this dialog belongs (opaque type). */ 
     
    192192    const void         *via_tp;     /**< Via transport.                     */ 
    193193}; 
     194 
     195/** 
     196 * The parameter for \a pjsip_dlg_create_uac2(). 
     197 */ 
     198typedef struct pjsip_dlg_create_uac_param { 
     199    /** 
     200     * The user agent module instance. 
     201     */ 
     202    pjsip_user_agent *ua; 
     203 
     204    /** 
     205     * Dialog local URI (i.e. From header). 
     206     */ 
     207    pj_str_t local_uri; 
     208 
     209    /** 
     210     * Optional dialog local Contact to be put as Contact header value, 
     211     * hence the format must follow RFC 3261 Section 20.10: 
     212     * When the header field value contains a display name, the URI including 
     213     * all URI parameters is enclosed in "<" and ">".  If no "<" and ">" are 
     214     * present, all parameters after the URI are header parameters, not 
     215     * URI parameters.  The display name can be tokens, or a quoted string, 
     216     * if a larger character set is desired. If this argument is NULL, 
     217     * the Contact will be taken from the local URI. 
     218     */ 
     219    pj_str_t local_contact; 
     220 
     221    /** 
     222     * Dialog remote URI (i.e. To header). 
     223     */ 
     224    pj_str_t remote_uri; 
     225 
     226    /** 
     227     * Optional initial remote target. If this argument is NULL, the initial  
     228     * target will be set to remote URI. 
     229     */ 
     230    pj_str_t target; 
     231 
     232    /** 
     233     * Optional group lock to use by this dialog. If the value is NULL,  
     234     * the dialog will create its own group lock. 
     235     */ 
     236    pj_grp_lock_t *grp_lock; 
     237 
     238} pjsip_dlg_create_uac_param; 
    194239 
    195240 
     
    249294                                           pjsip_dialog **p_dlg); 
    250295 
     296/** 
     297 * Variant of pjsip_dlg_create_uac() with additional parameter to specify 
     298 * the group lock to use. Group lock can be used to synchronize locking 
     299 * among several objects to prevent deadlock, and to synchronize the 
     300 * lifetime of objects sharing the same group lock. 
     301 * 
     302 * See \a pjsip_dlg_create_uac() for general info about this function. 
     303 * 
     304 * @param param             The parameter, refer to 
     305 *                          \a pjsip_dlg_create_uac_param 
     306 * @param p_dlg             Pointer to receive the dialog. 
     307 * 
     308 * @return                  PJ_SUCCESS on success. 
     309 */ 
     310PJ_DECL(pj_status_t) pjsip_dlg_create_uac2( 
     311                                const pjsip_dlg_create_uac_param *create_param, 
     312                                pjsip_dialog **p_dlg); 
     313 
    251314 
    252315#if !DEPRECATED_FOR_TICKET_1902 
     
    539602PJ_DECL(void) pjsip_dlg_dec_lock( pjsip_dialog *dlg ); 
    540603 
     604/** 
     605 * Get the group lock for the SIP dialog. Note that prior to calling this 
     606 * method, it is recommended to hold reference to the dialog 
     607 * (e.g: call #pjsip_dlg_inc_session() or #pjsip_dlg_inc_lock()). 
     608 * 
     609 * @param dlg               The dialog. 
     610 * 
     611 * @return                  The group lock. 
     612 */ 
     613PJ_DECL(pj_grp_lock_t *) pjsip_dlg_get_lock( pjsip_dialog *dlg ); 
     614 
    541615 
    542616/** 
Note: See TracChangeset for help on using the changeset viewer.