mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +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];
|
||||
|
||||
if (ctx != NULL && skynet_context_handle(ctx) == handle) {
|
||||
skynet_context_release(ctx);
|
||||
s->slot[hash] = NULL;
|
||||
ret = 1;
|
||||
int i;
|
||||
@@ -92,10 +91,17 @@ skynet_handle_retire(uint32_t handle) {
|
||||
++j;
|
||||
}
|
||||
s->name_count = j;
|
||||
} else {
|
||||
ctx = NULL;
|
||||
}
|
||||
|
||||
rwlock_wunlock(&s->lock);
|
||||
|
||||
if (ctx) {
|
||||
// release ctx may call skynet_handle_* , so wunlock first.
|
||||
skynet_context_release(ctx);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user