From ec50d9696d9e3de444161aef1fc572d225b3d78d Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" Date: Thu, 7 Sep 2023 17:05:47 +0200 Subject: [PATCH] clean up debug --- src/main/main.c | 13 +------------ test/remain.c | 12 ++++-------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/src/main/main.c b/src/main/main.c index f23fdcae1..9f32cdd98 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -1202,8 +1202,6 @@ void re_thread_close(void) */ void re_thread_enter(void) { - DEBUG_NOTICE("re_thread_enter\n"); - struct re *re = re_get(); if (!re) { @@ -1215,8 +1213,6 @@ void re_thread_enter(void) /* set only for non-re threads */ if (!thrd_equal(re->tid, thrd_current())) { - DEBUG_NOTICE("re_thread_enter:" - " setting THREAD_ENTER to True\n"); re_atomic_rlx_set(&re->thread_enter, true); } } @@ -1238,9 +1234,7 @@ void re_thread_leave(void) if (re->async) re_thread_async(NULL, NULL, NULL); - DEBUG_NOTICE("re_thread_leave: setting THREAD_ENTER to false\n"); re_atomic_rlx_set(&re->thread_enter, false); - re_unlock(re); } @@ -1321,18 +1315,13 @@ int re_thread_check(bool debug) if (te) return 0; - thrd_t cur = thrd_current(); - bool eq = 0 != thrd_equal(re->tid, cur); - if (eq) + if (thrd_equal(re->tid, thrd_current())) return 0; if (debug) { DEBUG_WARNING( "thread check: called from a NON-RE thread without " "thread_enter()! [thread_enter=%d]\n", te); - fprintf(stderr, ".... tid=%zu\n", (size_t)re->tid); - fprintf(stderr, ".... cur=%zu\n", (size_t)cur); - re_printf("%H\n", re_debug, NULL); #if DEBUG_LEVEL > 5 struct btrace trace; diff --git a/test/remain.c b/test/remain.c index 6ef4a8199..81747f7f6 100644 --- a/test/remain.c +++ b/test/remain.c @@ -158,15 +158,12 @@ static void mqueue_handler(int id, void *dat, void *arg) static int enterleave_thread_handler(void *arg) { struct data *data = arg; - int err; - - DEBUG_NOTICE("thread start\n"); /* Enter an 're' thread */ re_thread_enter(); /* note: allocated from this thread */ - err = mqueue_alloc(&data->mq, mqueue_handler, data); + int err = mqueue_alloc(&data->mq, mqueue_handler, data); /* Leave an 're' thread */ re_thread_leave(); @@ -176,8 +173,6 @@ static int enterleave_thread_handler(void *arg) err = mqueue_push(data->mq, 0, NULL); - DEBUG_NOTICE("thread stop\n"); - return err; } @@ -206,6 +201,7 @@ static int test_remain_enterleave(void) /* wait for thread to end */ thrd_join(data.tid, &err); + TEST_EQUALS(0, data.tmr_called); TEST_EQUALS(1, data.mqueue_called); out: @@ -218,9 +214,9 @@ int test_remain(void) { int err = 0; - if (0) { + if (1) { err = test_remain_thread(); - TEST_ERR(err); + TEST_ERR(err); } err = test_remain_enterleave();