Hi, Following this thread: https://lists.openwrt.org/pipermail/openwrt-devel/2015-April/032335.html
I know how to use ubus with threading by call ubus_invoke_async() instead ubus_invoke(). In ubus example: static struct ubus_request req; ubus_invoke_async(ctx, id, "hello", b.head, &req); req.fd_cb = test_client_fd_cb; req.complete_cb = test_client_complete_cb; ubus_complete_request_async(ctx, &req); We need to create a ubus_request to register callbacks and maybe more data for this callback. My question is how to call ubus_invoke_async() many times with one callback for this function. When I tried this with the same struct ubus_request and I got lost callback, then I tried to malloc this struct and It worked well, but I dont know how to free this struct. Digging in to source code: I found this struct will be assign to the main context, INIT_LIST_HEAD(&req->list); INIT_LIST_HEAD(&req->pending); req->ctx = ctx; req->peer = peer; req->seq = ++ctx->request_seq; I tried to do req->ctx= NULL; and free it in callback function but i didn't work. How could I do that? Thanks Tuan Nguyen
_______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel