quickjs-tart

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

commit c0877458748d660cb96c4006bf2808f5952ca019
parent fa280c5811fadfbf7e568e9bbb54dc9d3036ec5e
Author: Florian Dold <florian@dold.me>
Date:   Mon, 16 Jan 2023 18:25:33 +0100

configure thread size, improve error handling a bit

Diffstat:
Mtaler_wallet_core_lib.c | 16++++++++++++++--
Mtaler_wallet_core_lib.h | 4+++-
2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/taler_wallet_core_lib.c b/taler_wallet_core_lib.c @@ -169,19 +169,31 @@ run(void *cls) return NULL; } +#define WALLET_THREAD_STACK_SIZE (1024 * 512) -void +int TALER_WALLET_run (struct TALER_WALLET_Instance *wh) { pthread_t wallet_thread; char *line; size_t line_sz; + pthread_attr_t tattr; pthread_mutex_lock(&wh->handle_mutex); - pthread_create(&wallet_thread, NULL, run, wh); + if (0 != pthread_attr_setstacksize(&tattr, WALLET_THREAD_STACK_SIZE)) { + fprintf(stderr, "could not set stack size\n"); + return -1; + } + + if (0 != pthread_create(&wallet_thread, &tattr, run, wh)) { + fprintf(stderr, "could not create wallet thread\n"); + return -1; + } wh->wallet_thread = wallet_thread; + + return 0; } diff --git a/taler_wallet_core_lib.h b/taler_wallet_core_lib.h @@ -79,8 +79,10 @@ TALER_WALLET_send_request(struct TALER_WALLET_Instance *twi, * Run wallet-core in a thread. * * This function creates a new thread and returns immediately. + * + * Returns 0 on success or a non-zero error code otherwise. */ -void +int TALER_WALLET_run(struct TALER_WALLET_Instance *twi); /**