diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-06-27 16:23:32 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-06-27 16:23:32 +0000 |
commit | 0b41dddce2699e8bc1b6bd8031fb69d3c3b796f0 (patch) | |
tree | 09e0c2e23082042c703ccf541dd6e4d4551d4536 /include | |
parent | 1c8883a47e615c146a3d30e36b7b8da2fa400b88 (diff) |
Optimization suggested by Russell to cache the value of pthread_self() so
that it isn't evaluated every time through the loop.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@125880 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/lock.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/asterisk/lock.h b/include/asterisk/lock.h index 56f7b03f0..92299f3cd 100644 --- a/include/asterisk/lock.h +++ b/include/asterisk/lock.h @@ -1051,8 +1051,9 @@ static inline int _ast_rwlock_unlock(ast_rwlock_t *t, const char *name, if (lt->reentrancy) { int lock_found = 0; int i; + pthread_t self = pthread_self(); for (i = lt->reentrancy-1; i >= 0; --i) { - if (lt->thread[i] == pthread_self()) { + if (lt->thread[i] == self) { lock_found = 1; if (i != lt->reentrancy-1) { lt->file[i] = lt->file[lt->reentrancy-1]; |