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