BUG: console 里启动一个服务失败后,无法使用 abort 退出 skynet

FIX: init 模块前全局 context 计数加一,因为 init 失败后会去 release
context,此时会全局 context 计数减一。以前会因此导致全局 context
计数不准,而无法退出。
This commit is contained in:
Yecheng Fu
2012-12-20 17:17:21 +08:00
parent 0afea732d2
commit 10eeb67128

View File

@@ -103,6 +103,7 @@ skynet_context_new(const char * name, const char *param) {
ctx->handle = skynet_handle_register(ctx);
struct message_queue * queue = ctx->queue = skynet_mq_create(ctx->handle);
// init function maybe use ctx->handle, so it must init at last
_context_inc();
CHECKCALLING_BEGIN(ctx)
int r = skynet_module_instance_init(mod, inst, ctx, param);
@@ -116,7 +117,6 @@ skynet_context_new(const char * name, const char *param) {
if (ret) {
printf("[:%x] launch %s %s\n",ret->handle, name, param ? param : "");
}
_context_inc();
return ret;
} else {
skynet_context_release(ctx);