From 84d48fa476a2ce5f75b4b9bc7a3038e1285cddd7 Mon Sep 17 00:00:00 2001 From: Hinnerk van Bruinehsen <h.v.bruinehsen@fu-berlin.de> Date: Wed, 1 Oct 2014 03:57:54 +0200 Subject: [PATCH] tests: fix mutex_unlock_and_sleep pids --- tests/mutex_unlock_and_sleep/main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/mutex_unlock_and_sleep/main.c b/tests/mutex_unlock_and_sleep/main.c index 457538094d..8bc26bbe3f 100644 --- a/tests/mutex_unlock_and_sleep/main.c +++ b/tests/mutex_unlock_and_sleep/main.c @@ -24,6 +24,7 @@ static mutex_t mutex = MUTEX_INIT; static volatile int indicator, count; +static kernel_pid_t main_pid; static char stack[KERNEL_CONF_STACKSIZE_MAIN]; static void *second_thread(void *arg) @@ -31,7 +32,7 @@ static void *second_thread(void *arg) (void) arg; while (1) { mutex_lock(&mutex); - thread_wakeup(1); + thread_wakeup(main_pid); indicator--; mutex_unlock_and_sleep(&mutex); } @@ -43,7 +44,9 @@ int main(void) indicator = 0; count = 0; - thread_create(stack, + main_pid = thread_getpid(); + + kernel_pid_t second_pid = thread_create(stack, sizeof(stack), PRIORITY_MAIN - 1, CREATE_WOUT_YIELD | CREATE_STACKTEST, @@ -53,7 +56,7 @@ int main(void) while (1) { mutex_lock(&mutex); - thread_wakeup(2); + thread_wakeup(second_pid); indicator++; count++; -- GitLab