Skip to content

Commit

Permalink
main: add debug
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredh committed Sep 5, 2023
1 parent a5619c6 commit 1093132
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1316,16 +1316,21 @@ int re_thread_check(bool debug)
if (!re)
return EINVAL;

if (re_atomic_rlx(&re->thread_enter))
bool te = re_atomic_rlx(&re->thread_enter);
if (te)
return 0;

if (thrd_equal(re->tid, thrd_current()))
thrd_t cur = thrd_current();
bool eq = 0 != thrd_equal(re->tid, cur);
if (eq)
return 0;

if (debug) {
DEBUG_WARNING(
"thread check: called from a NON-RE thread without "
"thread_enter()!\n");
"thread_enter()! [te=%d, eq=%d]\n", te, eq);
fprintf(stderr, ".... tid=%lu\n", re->tid);
fprintf(stderr, ".... cur=%lu\n", cur);

#if DEBUG_LEVEL > 5
struct btrace trace;
Expand Down

0 comments on commit 1093132

Please sign in to comment.