quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

commit fa280c5811fadfbf7e568e9bbb54dc9d3036ec5e
parent 014de832b405fdf90e46160b25b1315a67377c2c
Author: Florian Dold <florian@dold.me>
Date:   Mon, 16 Jan 2023 18:11:46 +0100

skeleton for destroy function

Diffstat:
Mtaler_wallet_core_lib.c | 17++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/taler_wallet_core_lib.c b/taler_wallet_core_lib.c @@ -49,6 +49,7 @@ struct TALER_WALLET_Instance void *handler_cls; }; + static int eval_buf(JSContext *ctx, const char *codestr, const char *filename) { JSValue val; @@ -64,6 +65,7 @@ static int eval_buf(JSContext *ctx, const char *codestr, const char *filename) return ret; } + /* also used to initialize the worker context */ static JSContext *JS_NewCustomContext(JSRuntime *rt) { @@ -79,6 +81,7 @@ static JSContext *JS_NewCustomContext(JSRuntime *rt) return ctx; } + void TALER_WALLET_set_message_handler(struct TALER_WALLET_Instance *twi, TALER_WALLET_MessageHandlerFn handler_f, @@ -88,6 +91,7 @@ TALER_WALLET_set_message_handler(struct TALER_WALLET_Instance *twi, twi->handler_f = handler_f; } + int TALER_WALLET_send_request (struct TALER_WALLET_Instance *twi, const char *msg) @@ -99,6 +103,7 @@ TALER_WALLET_send_request (struct TALER_WALLET_Instance *twi, return ret; } + static void wallet_host_message_handler(void *cls, const char *msg) { @@ -109,6 +114,7 @@ wallet_host_message_handler(void *cls, const char *msg) } } + struct TALER_WALLET_Instance * TALER_WALLET_create(void) { @@ -122,6 +128,7 @@ TALER_WALLET_create(void) return wh; } + static void * run(void *cls) { @@ -153,7 +160,6 @@ run(void *cls) pthread_mutex_unlock(&wh->handle_mutex); eval_buf(wh->ctx, "installNativeWalletListener()", "<talerwalletcore>"); - //eval_buf(wh->ctx, "setTimeout(() => console.log('hehe'), 1000);", "<talerwalletcore>"); printf("starting main loop\n"); @@ -163,6 +169,7 @@ run(void *cls) return NULL; } + void TALER_WALLET_run (struct TALER_WALLET_Instance *wh) { @@ -177,7 +184,15 @@ TALER_WALLET_run (struct TALER_WALLET_Instance *wh) wh->wallet_thread = wallet_thread; } + void TALER_WALLET_join(struct TALER_WALLET_Instance *wh) { pthread_join(wh->wallet_thread, NULL); } + + +void +TALER_WALLET_destroy(struct TALER_WALLET_Instance *twi) +{ + // FIXME: Implement! +}