Changes in kernel/test/synch/semaphore1.c [31e15be:0f4f1b2] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/test/synch/semaphore1.c
r31e15be r0f4f1b2 46 46 static void producer(void *arg) 47 47 { 48 thread_detach(THREAD);49 50 48 waitq_sleep(&can_start); 51 49 … … 58 56 static void consumer(void *arg) 59 57 { 60 thread_detach(THREAD);61 62 58 waitq_sleep(&can_start); 63 59 … … 93 89 thrd = thread_create(consumer, NULL, TASK, 94 90 THREAD_FLAG_NONE, "consumer"); 95 if (thrd) 96 thread_ready(thrd); 97 else 91 if (thrd) { 92 thread_start(thrd); 93 thread_detach(thrd); 94 } else { 98 95 TPRINTF("could not create consumer %d\n", i); 96 } 99 97 } 100 98 for (k = 0; k < (4 - i); k++) { 101 99 thrd = thread_create(producer, NULL, TASK, 102 100 THREAD_FLAG_NONE, "producer"); 103 if (thrd) 104 thread_ready(thrd); 105 else 101 if (thrd) { 102 thread_start(thrd); 103 thread_detach(thrd); 104 } else { 106 105 TPRINTF("could not create producer %d\n", i); 106 } 107 107 } 108 108 } … … 111 111 112 112 thread_sleep(1); 113 waitq_wake up(&can_start, WAKEUP_ALL);113 waitq_wake_all(&can_start); 114 114 115 115 while ((items_consumed != consumers) || (items_produced != producers)) {
Note:
See TracChangeset
for help on using the changeset viewer.