skynet_context: skynet_context_new 改为返回 handle 避免调用者拿到悬垂指针 (#2095)

* skynet_context: skynet_context_new 改为返回 handle 避免调用者拿到悬垂指针

* 推迟 skynet_handle_grab(logger_handle) 到 bootstrap 失败阶段

---------

Co-authored-by: efve.zff <efve.zff@alibaba-inc.com>
This commit is contained in:
EfveZombie
2025-10-14 18:00:58 +08:00
committed by GitHub
parent d4b78b7ff1
commit 7386688320
3 changed files with 54 additions and 55 deletions

View File

@@ -8,10 +8,10 @@ struct skynet_context;
struct skynet_message;
struct skynet_monitor;
struct skynet_context * skynet_context_new(const char * name, const char * parm);
uint32_t skynet_context_new(const char * name, const char * parm);
void skynet_context_grab(struct skynet_context *);
void skynet_context_reserve(struct skynet_context *ctx);
struct skynet_context * skynet_context_release(struct skynet_context *);
void skynet_context_release(struct skynet_context *);
uint32_t skynet_context_handle(struct skynet_context *);
int skynet_context_push(uint32_t handle, struct skynet_message *message);
void skynet_context_send(struct skynet_context * context, void * msg, size_t sz, uint32_t source, int type, int session);