Changes in kernel/test/synch/semaphore2.c [a35b458:1b20da0] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/test/synch/semaphore2.c
ra35b458 r1b20da0 50 50 { 51 51 uint32_t rc; 52 52 53 53 spinlock_lock(&sem_lock); 54 54 rc = seed % max; … … 62 62 errno_t rc; 63 63 int to; 64 64 65 65 thread_detach(THREAD); 66 66 67 67 waitq_sleep(&can_start); 68 68 69 69 to = random(20000); 70 70 TPRINTF("cpu%u, tid %" PRIu64 " down+ (%d)\n", CPU->id, THREAD->tid, to); … … 74 74 return; 75 75 } 76 76 77 77 TPRINTF("cpu%u, tid %" PRIu64 " down=\n", CPU->id, THREAD->tid); 78 78 thread_usleep(random(30000)); 79 79 80 80 semaphore_up(&sem); 81 81 TPRINTF("cpu%u, tid %" PRIu64 " up\n", CPU->id, THREAD->tid); … … 85 85 { 86 86 uint32_t i, k; 87 87 88 88 waitq_initialize(&can_start); 89 89 semaphore_initialize(&sem, 5); 90 90 91 91 thread_t *thrd; 92 92 93 93 k = random(7) + 1; 94 94 TPRINTF("Creating %" PRIu32 " consumers\n", k); … … 101 101 TPRINTF("Error creating thread\n"); 102 102 } 103 103 104 104 thread_usleep(20000); 105 105 waitq_wakeup(&can_start, WAKEUP_ALL); 106 106 107 107 return NULL; 108 108 }
Note:
See TracChangeset
for help on using the changeset viewer.