1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #1744 from N8Fear/fix-mutex_unlock_and_sleep

tests: fix mutex_unlock_and_sleep pids
This commit is contained in:
Hinnerk van Bruinehsen 2014-10-01 16:44:30 +02:00
commit e37a34de42

View File

@ -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++;