diff options
author | Richard Mudgett <rmudgett@digium.com> | 2016-08-03 16:24:39 -0500 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2016-08-11 11:58:38 -0500 |
commit | 5ba6357be2a140e558ddc14b7669bb08d035944d (patch) | |
tree | 048f51a0e7fafb5246e46510e957f739e45e8387 /res/res_pjsip_registrar_expire.c | |
parent | e845ef6762bdfd404f1f3f2b5c22c66e49eaec68 (diff) |
res_pjsip: Make aor named lock a mutex.
The named aor lock was always being locked for writes so a rwlock adds no
benefit and may be slower because rwlocks are biased toward read locking.
Change-Id: I8c5c2c780eb30ce5441832257beeb3506fd12b28
Diffstat (limited to 'res/res_pjsip_registrar_expire.c')
-rw-r--r-- | res/res_pjsip_registrar_expire.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/res/res_pjsip_registrar_expire.c b/res/res_pjsip_registrar_expire.c index 0d979a13f..61841a054 100644 --- a/res/res_pjsip_registrar_expire.c +++ b/res/res_pjsip_registrar_expire.c @@ -44,7 +44,7 @@ static int expire_contact(void *obj, void *arg, int flags) struct ast_sip_contact *contact = obj; struct ast_named_lock *lock; - lock = ast_named_lock_get(AST_NAMED_LOCK_TYPE_RWLOCK, "aor", contact->aor); + lock = ast_named_lock_get(AST_NAMED_LOCK_TYPE_MUTEX, "aor", contact->aor); if (!lock) { return 0; } @@ -53,7 +53,7 @@ static int expire_contact(void *obj, void *arg, int flags) * We need to check the expiration again with the aor lock held * in case another thread is attempting to renew the contact. */ - ao2_wrlock(lock); + ao2_lock(lock); if (ast_tvdiff_ms(ast_tvnow(), contact->expiration_time) > 0) { ast_sip_location_delete_contact(contact); } |