Changes in / [9f945464:2c94501] in mainline
- Location:
- kernel
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/synch/condvar.h
r9f945464 r2c94501 46 46 } condvar_t; 47 47 48 #define CONDVAR_INITIALIZER(name) (condvar_t) { \49 .wq = WAITQ_INITIALIZER((name).wq), \50 }51 52 #define CONDVAR_INITIALIZE(name) \53 condvar_t name = CONDVAR_INITIALIZER(name)54 55 48 #ifdef CONFIG_SMP 56 49 #define _condvar_wait_timeout_spinlock(cv, lock, usec, flags) \ -
kernel/generic/include/synch/mutex.h
r9f945464 r2c94501 56 56 } mutex_t; 57 57 58 #define MUTEX_INITIALIZER(name, mtype) (mutex_t) { \59 .type = (mtype), \60 .sem = SEMAPHORE_INITIALIZER((name).sem, 1), \61 .owner = NULL, \62 .nesting = 0, \63 }64 65 #define MUTEX_INITIALIZE(name, mtype) \66 mutex_t name = MUTEX_INITIALIZER(name, mtype)67 68 58 extern void mutex_initialize(mutex_t *, mutex_type_t); 69 59 extern bool mutex_locked(mutex_t *); -
kernel/generic/include/synch/semaphore.h
r9f945464 r2c94501 45 45 } semaphore_t; 46 46 47 #define SEMAPHORE_INITIALIZER(name, count) (semaphore_t) { \48 .wq = WAITQ_INITIALIZER_WITH_COUNT((name).wq, count), \49 }50 51 #define SEMAPHORE_INITIALIZE(name, count) \52 semaphore_t name = SEMAPHORE_INITIALIZER(name, count)53 54 47 extern void semaphore_initialize(semaphore_t *, int); 55 48 extern errno_t semaphore_down_timeout(semaphore_t *, uint32_t); -
kernel/generic/include/synch/waitq.h
r9f945464 r2c94501 40 40 #include <abi/synch.h> 41 41 #include <adt/list.h> 42 43 #define WAITQ_INITIALIZER_WITH_COUNT(name, count) (waitq_t) { \44 .lock = IRQ_SPINLOCK_INITIALIZER(#name ".lock"), \45 .sleepers = LIST_INITIALIZER((name).sleepers), \46 .wakeup_balance = (count), \47 }48 49 #define WAITQ_INITIALIZER(name) WAITQ_INITIALIZER_WITH_COUNT(name, 0)50 51 #define WAITQ_INITIALIZE_WITH_COUNT(name, count) \52 waitq_t name = WAITQ_INITIALIZER_WITH_COUNT(name, count)53 54 #define WAITQ_INITIALIZE(name) \55 waitq_t name = WAITQ_INITIALIZER(name)56 42 57 43 /** Wait queue structure. -
kernel/generic/src/ddi/ddi.c
r9f945464 r2c94501 60 60 61 61 /** This lock protects the @c pareas ordered dictionary. */ 62 static MUTEX_INITIALIZE(pareas_lock, MUTEX_PASSIVE);62 static mutex_t pareas_lock; 63 63 64 64 /** Ordered dictionary of enabled physical memory areas by base address. */ … … 74 74 { 75 75 odict_initialize(&pareas, pareas_getkey, pareas_cmp); 76 mutex_initialize(&pareas_lock, MUTEX_PASSIVE); 76 77 } 77 78 -
kernel/generic/src/main/main.c
r9f945464 r2c94501 53 53 #include <stdio.h> 54 54 #include <panic.h> 55 #include <assert.h> 55 56 #include <config.h> 56 57 #include <time/clock.h> -
kernel/generic/src/mm/frame.c
r9f945464 r2c94501 63 63 #include <proc/thread.h> /* THREAD */ 64 64 65 zones_t zones = { 66 .count = 0, 67 .lock = IRQ_SPINLOCK_INITIALIZER("frame.zones.lock"), 68 }; 65 zones_t zones; 69 66 70 67 /* … … 72 69 * available. 73 70 */ 74 static MUTEX_INITIALIZE(mem_avail_mtx, MUTEX_ACTIVE);75 static CONDVAR_INITIALIZE(mem_avail_cv);71 static mutex_t mem_avail_mtx; 72 static condvar_t mem_avail_cv; 76 73 static size_t mem_avail_req = 0; /**< Number of frames requested. */ 77 74 static size_t mem_avail_gen = 0; /**< Generation counter. */ … … 1111 1108 void frame_init(void) 1112 1109 { 1110 if (config.cpu_active == 1) { 1111 zones.count = 0; 1112 irq_spinlock_initialize(&zones.lock, "frame.zones.lock"); 1113 mutex_initialize(&mem_avail_mtx, MUTEX_ACTIVE); 1114 condvar_initialize(&mem_avail_cv); 1115 } 1116 1113 1117 /* Tell the architecture to create some memory */ 1114 1118 frame_low_arch_init(); -
kernel/generic/src/proc/thread.c
r9f945464 r2c94501 667 667 void thread_usleep(uint32_t usec) 668 668 { 669 WAITQ_INITIALIZE(wq); 669 waitq_t wq; 670 671 waitq_initialize(&wq); 672 670 673 (void) waitq_sleep_timeout(&wq, usec); 671 674 } -
kernel/generic/src/synch/condvar.c
r9f945464 r2c94501 48 48 void condvar_initialize(condvar_t *cv) 49 49 { 50 *cv = CONDVAR_INITIALIZER(*cv);50 waitq_initialize(&cv->wq); 51 51 } 52 52 -
kernel/generic/src/synch/mutex.c
r9f945464 r2c94501 53 53 void mutex_initialize(mutex_t *mtx, mutex_type_t type) 54 54 { 55 *mtx = MUTEX_INITIALIZER(*mtx, type); 55 mtx->type = type; 56 mtx->owner = NULL; 57 mtx->nesting = 0; 58 semaphore_initialize(&mtx->sem, 1); 56 59 } 57 60 -
kernel/generic/src/synch/semaphore.c
r9f945464 r2c94501 52 52 void semaphore_initialize(semaphore_t *sem, int val) 53 53 { 54 *sem = SEMAPHORE_INITIALIZER(*sem, val);54 waitq_initialize_with_count(&sem->wq, val); 55 55 } 56 56 -
kernel/generic/src/synch/waitq.c
r9f945464 r2c94501 70 70 void waitq_initialize(waitq_t *wq) 71 71 { 72 *wq = WAITQ_INITIALIZER(*wq); 72 memsetb(wq, sizeof(*wq), 0); 73 irq_spinlock_initialize(&wq->lock, "wq.lock"); 74 list_initialize(&wq->sleepers); 73 75 } 74 76 … … 79 81 void waitq_initialize_with_count(waitq_t *wq, int count) 80 82 { 81 *wq = WAITQ_INITIALIZER_WITH_COUNT(*wq, count); 83 waitq_initialize(wq); 84 wq->wakeup_balance = count; 82 85 } 83 86 -
kernel/generic/src/sysinfo/stats.c
r9f945464 r2c94501 90 90 91 91 /** Load calculation lock */ 92 static MUTEX_INITIALIZE(load_lock, MUTEX_PASSIVE);92 static mutex_t load_lock; 93 93 94 94 /** Get statistics of all CPUs … … 846 846 void stats_init(void) 847 847 { 848 mutex_initialize(&load_lock, MUTEX_PASSIVE); 849 848 850 sysinfo_set_item_gen_data("system.cpus", NULL, get_stats_cpus, NULL); 849 851 sysinfo_set_item_gen_data("system.physmem", NULL, get_stats_physmem, NULL); -
kernel/generic/src/sysinfo/sysinfo.c
r9f945464 r2c94501 57 57 58 58 /** Sysinfo lock */ 59 static MUTEX_INITIALIZE(sysinfo_lock, MUTEX_ACTIVE);59 static mutex_t sysinfo_lock; 60 60 61 61 /** Sysinfo item constructor … … 102 102 sizeof(sysinfo_item_t), 0, sysinfo_item_constructor, 103 103 sysinfo_item_destructor, SLAB_CACHE_MAGDEFERRED); 104 105 mutex_initialize(&sysinfo_lock, MUTEX_ACTIVE); 104 106 } 105 107 -
kernel/test/mm/slab2.c
r9f945464 r2c94501 127 127 128 128 static slab_cache_t *thr_cache; 129 static CONDVAR_INITIALIZE(thread_starter);130 static MUTEX_INITIALIZE(starter_mutex, MUTEX_PASSIVE);129 static condvar_t thread_starter; 130 static mutex_t starter_mutex; 131 131 132 132 #define THREADS 8 … … 197 197 198 198 TPRINTF("Running stress test with size %d\n", size); 199 200 condvar_initialize(&thread_starter); 201 mutex_initialize(&starter_mutex, MUTEX_PASSIVE); 199 202 200 203 thr_cache = slab_cache_create("thread_cache", size, 0, NULL, NULL, 0);
Note:
See TracChangeset
for help on using the changeset viewer.