From c341b2bdb0259ea00c08a33a0e1d71d678039725 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 16 Jan 2025 18:41:39 -0300 Subject: src/trace.c: Replace thread_local with pthreads --- tests/trace.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/trace.c b/tests/trace.c index aa10c81..5b59a46 100644 --- a/tests/trace.c +++ b/tests/trace.c @@ -19,7 +19,7 @@ test_ftracef(void) { FILE *file = NULL; char *str = NULL; - const enum TraceLevel orig = LEVEL; + const enum TraceLevel orig = (enum TraceLevel)pthread_getspecific(LEVEL_KEY); trace_set_level(TraceLevel_INFO); { @@ -191,7 +191,15 @@ int main(void) { int rc = EXIT_FAILURE; - LEVEL = TraceLevel_DEBUG; + if (pthread_once(&ONCE, init)) { + perror("pthread_once()"); + goto out; + } + + if (trace_set_level(TraceLevel_DEBUG)) { + perror("trace_set_level()"); + goto out; + } if (test_ftracef()) { perror("test_ftracef()"); -- cgit v1.2.3