support passing args to request handle for elimination of global var

This commit is contained in:
Rongsong Shen 2025-12-11 17:07:51 +08:00
parent 79124c6e5c
commit 486b38d679
8 changed files with 120 additions and 19 deletions

View file

@ -15,7 +15,7 @@ typedef enum {
XCE_CTX_ERR
} xce_ctx_state_t;
typedef int (*xce_request_handler_t)(xce_request_t*);
typedef int (*xce_request_handler_t)(xce_request_t*, void*);
typedef struct {
xce_ctx_state_t state;
@ -24,6 +24,7 @@ typedef struct {
vtaskmgr_t vtaskmgr;
endpoint_t* ep;
xce_request_handler_t handler;
void* handler_args;
cbuf_t wbuf;
dataset_t* dataset;
@ -39,7 +40,7 @@ typedef struct {
extern int xce_ctx_init(xce_ctx_t*, char*, char*);
extern void xce_ctx_fini(xce_ctx_t*);
extern int xce_ctx_set_handler(xce_ctx_t*, xce_request_handler_t);
extern int xce_ctx_set_handler(xce_ctx_t*, xce_request_handler_t, void*);
extern int xce_ctx_start(xce_ctx_t*);
extern int xce_ctx_stop(xce_ctx_t*);
extern int xce_wakeup(xce_ctx_t*, int);