exposed loop defer function from capi (#1579)

Co-authored-by: g.fetishev <g.fetishev@aligntech.com>
This commit is contained in:
Genrikh Fetischev
2023-03-06 11:34:59 +01:00
committed by GitHub
parent 8a1ed3cba8
commit 09d2795852
2 changed files with 10 additions and 0 deletions
+9
View File
@@ -23,6 +23,7 @@
#include "libuwebsockets.h" #include "libuwebsockets.h"
#include <string_view> #include <string_view>
#include "App.h" #include "App.h"
#include "ClientApp.h"
#include <optional> #include <optional>
extern "C" extern "C"
{ {
@@ -1348,4 +1349,12 @@ extern "C"
{ {
return (struct us_loop_t *)uWS::Loop::get(existing_native_loop); return (struct us_loop_t *)uWS::Loop::get(existing_native_loop);
} }
void uws_loop_defer(us_loop_t *loop, void( cb(void *user_data) ), void *user_data)
{
uWS::Loop *loop_instance = (uWS::Loop *)loop;
loop_instance->defer([cb, user_data](){
cb(user_data);
});
}
} }
+1
View File
@@ -250,6 +250,7 @@ extern "C"
DLL_EXPORT struct us_loop_t *uws_get_loop(); DLL_EXPORT struct us_loop_t *uws_get_loop();
DLL_EXPORT struct us_loop_t *uws_get_loop_with_native(void* existing_native_loop); DLL_EXPORT struct us_loop_t *uws_get_loop_with_native(void* existing_native_loop);
DLL_EXPORT void uws_loop_defer(struct us_loop_t *loop, void( cb(void *user_data) ), void *user_data);
#ifdef __cplusplus #ifdef __cplusplus
} }