Changeset a35b458 in mainline for kernel/test/synch/semaphore2.c
- Timestamp:
- 2018-03-02T20:10:49Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f1380b7
- Parents:
- 3061bc1
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/test/synch/semaphore2.c
r3061bc1 ra35b458 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.