mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-16 22:38:38 +00:00
still try to graceful shutdown in dire cirumstances
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9490 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
1 parent
860b838b63
commit
c8b8672a3e
4 files changed
+40
-9
No files matched your search
@@ -170,6 +170,22 @@ SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_trywrlock(switch_thread_rwl
|
||||
return apr_thread_rwlock_trywrlock(rwlock);
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_trywrlock_timeout(switch_thread_rwlock_t *rwlock, int timeout)
|
||||
{
|
||||
int sanity = timeout * 2;
|
||||
|
||||
while (sanity) {
|
||||
if (switch_thread_rwlock_trywrlock(rwlock) == SWITCH_STATUS_SUCCESS) {
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
sanity--;
|
||||
switch_yield(500000);
|
||||
}
|
||||
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_unlock(switch_thread_rwlock_t *rwlock)
|
||||
{
|
||||
return apr_thread_rwlock_unlock(rwlock);
|
||||
|
||||
Reference in new issue
Block a user