tests: fix mutex_unlock_and_sleep pids

This commit is contained in:
Hinnerk van Bruinehsen 2014-10-01 03:57:54 +02:00
parent 2fc0ae28cf
commit 84d48fa476

View File

@ -24,6 +24,7 @@
static mutex_t mutex = MUTEX_INIT; static mutex_t mutex = MUTEX_INIT;
static volatile int indicator, count; static volatile int indicator, count;
static kernel_pid_t main_pid;
static char stack[KERNEL_CONF_STACKSIZE_MAIN]; static char stack[KERNEL_CONF_STACKSIZE_MAIN];
static void *second_thread(void *arg) static void *second_thread(void *arg)
@ -31,7 +32,7 @@ static void *second_thread(void *arg)
(void) arg; (void) arg;
while (1) { while (1) {
mutex_lock(&mutex); mutex_lock(&mutex);
thread_wakeup(1); thread_wakeup(main_pid);
indicator--; indicator--;
mutex_unlock_and_sleep(&mutex); mutex_unlock_and_sleep(&mutex);
} }
@ -43,7 +44,9 @@ int main(void)
indicator = 0; indicator = 0;
count = 0; count = 0;
thread_create(stack, main_pid = thread_getpid();
kernel_pid_t second_pid = thread_create(stack,
sizeof(stack), sizeof(stack),
PRIORITY_MAIN - 1, PRIORITY_MAIN - 1,
CREATE_WOUT_YIELD | CREATE_STACKTEST, CREATE_WOUT_YIELD | CREATE_STACKTEST,
@ -53,7 +56,7 @@ int main(void)
while (1) { while (1) {
mutex_lock(&mutex); mutex_lock(&mutex);
thread_wakeup(2); thread_wakeup(second_pid);
indicator++; indicator++;
count++; count++;