From 2e13d840a8842d7dc5c4a89cefdb86a1928ec09f Mon Sep 17 00:00:00 2001 From: JesterHodl Date: Mon, 21 Oct 2024 21:29:58 +0200 Subject: [PATCH] Implement failure handling in datum_coinbaser_init. --- src/datum_coinbaser.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/datum_coinbaser.c b/src/datum_coinbaser.c index db946a1..a8c8f1d 100644 --- a/src/datum_coinbaser.c +++ b/src/datum_coinbaser.c @@ -872,8 +872,13 @@ void *datum_coinbaser_thread(void *ptr) { } int datum_coinbaser_init(void) { - // TODO: Handle failed (rare, not priority) pthread_t pthread_datum_coinbaser_thread; - pthread_create(&pthread_datum_coinbaser_thread, NULL, datum_coinbaser_thread, NULL); + int result = pthread_create(&pthread_datum_coinbaser_thread, NULL, datum_coinbaser_thread, NULL); + + if (result != 0) { + DLOG_FATAL("datum_coinbaser_init: pthread_create failed with code %d", result); + return -1; + } + return 0; }