TT#14008 fix call iterator dead lock

... almost there ...

Change-Id: I3261ec91ac7481bb275bbb4f9841747938706e61
pull/1346/head
Richard Fuchs 4 years ago
parent 9952647d19
commit 99fbff408e

@ -2851,7 +2851,8 @@ void call_destroy(struct call *c) {
}
if (next_call) {
if (mutex_trylock(&next_call->iterator[i].prev_lock)) {
mutex_unlock(&prev_call->iterator[i].next_lock);
if (prev_call)
mutex_unlock(&prev_call->iterator[i].next_lock);
mutex_unlock(&c->iterator[i].next_lock);
mutex_unlock(&c->iterator[i].prev_lock);
mutex_unlock(&rtpe_call_iterators[i].lock);

@ -437,6 +437,7 @@ struct call_iterator_entry {
mutex_lock(&rtpe_call_iterators[__which].lock); \
\
GList *__l = rtpe_call_iterators[__which].first; \
bool __has_lock = true; \
struct call *next_ ## varname = NULL; \
while (__l) { \
struct call *varname = NULL; \
@ -447,7 +448,9 @@ struct call_iterator_entry {
obj_hold(varname); \
mutex_lock(&varname->iterator[__which].next_lock); \
} \
mutex_unlock(&rtpe_call_iterators[__which].lock)
if (__has_lock) \
mutex_unlock(&rtpe_call_iterators[__which].lock); \
__has_lock = false
#define ITERATE_CALL_LIST_NEXT_END(varname) \
GList *__next = varname->iterator[__which].link.next; \
@ -461,10 +464,9 @@ struct call_iterator_entry {
mutex_unlock(&varname->iterator[__which].next_lock); \
__l = __next; \
obj_put(varname); \
mutex_lock(&rtpe_call_iterators[__which].lock); \
} \
\
mutex_unlock(&rtpe_call_iterators[__which].lock); \
if (__has_lock) \
mutex_unlock(&rtpe_call_iterators[__which].lock); \
} while (0)
struct call {

Loading…
Cancel
Save