mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 04:33:05 +00:00
bugfix: wunlock first, and then release context. (may dead lock)
This commit is contained in:
@@ -77,7 +77,6 @@ skynet_handle_retire(uint32_t handle) {
|
|||||||
struct skynet_context * ctx = s->slot[hash];
|
struct skynet_context * ctx = s->slot[hash];
|
||||||
|
|
||||||
if (ctx != NULL && skynet_context_handle(ctx) == handle) {
|
if (ctx != NULL && skynet_context_handle(ctx) == handle) {
|
||||||
skynet_context_release(ctx);
|
|
||||||
s->slot[hash] = NULL;
|
s->slot[hash] = NULL;
|
||||||
ret = 1;
|
ret = 1;
|
||||||
int i;
|
int i;
|
||||||
@@ -92,10 +91,17 @@ skynet_handle_retire(uint32_t handle) {
|
|||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
s->name_count = j;
|
s->name_count = j;
|
||||||
|
} else {
|
||||||
|
ctx = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
rwlock_wunlock(&s->lock);
|
rwlock_wunlock(&s->lock);
|
||||||
|
|
||||||
|
if (ctx) {
|
||||||
|
// release ctx may call skynet_handle_* , so wunlock first.
|
||||||
|
skynet_context_release(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user