add an inline function to add the ubus socket to uloop
This commit is contained in:
parent
4f8b3c8d46
commit
659a98c810
2 changed files with 6 additions and 1 deletions
|
@ -131,6 +131,11 @@ void ubus_free(struct ubus_context *ctx);
|
|||
|
||||
const char *ubus_strerror(int error);
|
||||
|
||||
static inline void ubus_add_uloop(struct ubus_context *ctx)
|
||||
{
|
||||
uloop_fd_add(&ctx->sock, ULOOP_EDGE_TRIGGER | ULOOP_BLOCKING | ULOOP_READ);
|
||||
}
|
||||
|
||||
/* ----------- raw request handling ----------- */
|
||||
|
||||
/* wait for a request to complete and return its status */
|
||||
|
|
|
@ -74,7 +74,7 @@ int main(int argc, char **argv)
|
|||
fprintf(stderr, "Object Type ID: %08x\n", test_object2.type->id);
|
||||
}
|
||||
uloop_init();
|
||||
uloop_fd_add(&ctx->sock, ULOOP_READ | ULOOP_EDGE_TRIGGER);
|
||||
ubus_add_uloop(ctx);
|
||||
uloop_run();
|
||||
|
||||
ubus_free(ctx);
|
||||
|
|
Loading…
Reference in a new issue