forked from lei.chen/myxce
support passing args to request handle for elimination of global var
This commit is contained in:
parent
79124c6e5c
commit
486b38d679
8 changed files with 120 additions and 19 deletions
|
|
@ -9,7 +9,10 @@
|
|||
#include "xce/types.h"
|
||||
#include "xceapi.h"
|
||||
|
||||
typedef int (*xce_request_handler_t)(xce_request_t*);
|
||||
#if 0
|
||||
typedef int (*xce_request_handler_t)(xce_request_t*, void*);
|
||||
#endif
|
||||
|
||||
typedef void* xcecli_ctx_t;
|
||||
|
||||
#define N_MAX_MASTERS (3)
|
||||
|
|
@ -26,7 +29,7 @@ typedef struct {
|
|||
|
||||
extern int xcecli_ctx_init(xcecli_ctx_t*, xce_client_config_t*);
|
||||
extern void xcecli_ctx_fini(xcecli_ctx_t);
|
||||
extern int xcecli_set_handler(xcecli_ctx_t, xce_request_handler_t);
|
||||
extern int xcecli_set_handler(xcecli_ctx_t, xce_request_handler_t, void*);
|
||||
extern int xcecli_start(xcecli_ctx_t);
|
||||
extern int xcecli_stop(xcecli_ctx_t);
|
||||
extern int xcecli_wakeup(xcecli_ctx_t, int);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue