From 532feb88f516f0848ae0e3eaf3a89a1fc94db6c4 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 4 Jul 2011 16:57:03 +0930 Subject: [PATCH 1/1] tap: WANT_PTHREAD not HAVE_PTHREAD I'm not sure that a "pthread-safe" tap library is very useful; how many people have multiple threads calling ok()? Kirill Shutemov noted that it gives a warning with -Wundef; indeed, we should ask in this case whether they want pthread support, not whether the system has pthread support to offer. --- ccan/tap/tap.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ccan/tap/tap.c b/ccan/tap/tap.c index b7a84ac9..7c01e140 100644 --- a/ccan/tap/tap.c +++ b/ccan/tap/tap.c @@ -45,8 +45,13 @@ static int test_died = 0; static int test_pid; /* Encapsulate the pthread code in a conditional. In the absence of - libpthread the code does nothing */ -#if HAVE_LIBPTHREAD + libpthread the code does nothing. + + If you have multiple threads calling ok() etc. at the same time you would + need this, but in that case your test numbers will be random and I'm not + sure it makes sense. --RR +*/ +#ifdef WANT_PTHREAD #include static pthread_mutex_t M = PTHREAD_MUTEX_INITIALIZER; # define LOCK pthread_mutex_lock(&M) -- 2.39.2