Changeset f02436c8 in mainline
- Timestamp:
- 2005-10-02T17:11:12Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 63975c6
- Parents:
- ac4177ca
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/synch/rwlock.c
rac4177ca rf02436c8 51 51 */ 52 52 53 #include <synch/synch.h>54 53 #include <synch/rwlock.h> 55 54 #include <synch/spinlock.h> 56 55 #include <synch/mutex.h> 57 56 #include <synch/waitq.h> 58 57 #include <synch/synch.h> 59 58 #include <list.h> 60 59 #include <typedefs.h> … … 70 69 static void release_spinlock(void *arg); 71 70 71 /** Initialize reader/writer lock 72 * 73 * Initialize reader/writer lock. 74 * 75 * @param rwl Reader/Writer lock. 76 */ 72 77 void rwlock_initialize(rwlock_t *rwl) { 73 78 spinlock_initialize(&rwl->lock); … … 76 81 } 77 82 83 /** Acquire reader/writer lock for reading 84 * 85 * Acquire reader/writer lock for reading. 86 * Timeout and willingness to block may be specified. 87 * 88 * @param rwl Reader/Writer lock. 89 * @param usec Timeout in microseconds. 90 * @param trylock Switches between blocking and non-blocking mode. 91 * 92 * For exact description of possible combinations of 93 * 'usec' and 'trylock', see comment for waitq_sleep_timeout(). 94 * 95 * @return See comment for waitq_sleep_timeout(). 96 */ 78 97 int _rwlock_write_lock_timeout(rwlock_t *rwl, __u32 usec, int trylock) 79 98 { … … 116 135 } 117 136 137 /** Acquire reader/writer lock for writing 138 * 139 * Acquire reader/writer lock for writing. 140 * Timeout and willingness to block may be specified. 141 * 142 * @param rwl Reader/Writer lock. 143 * @param usec Timeout in microseconds. 144 * @param trylock Switches between blocking and non-blocking mode. 145 * 146 * For exact description of possible combinations of 147 * 'usec' and 'trylock', see comment for waitq_sleep_timeout(). 148 * 149 * @return See comment for waitq_sleep_timeout(). 150 */ 118 151 int _rwlock_read_lock_timeout(rwlock_t *rwl, __u32 usec, int trylock) 119 152 { … … 209 242 } 210 243 244 /** Release reader/writer lock held by writer 245 * 246 * Release reader/writer lock held by writer. 247 * Handoff reader/writer lock ownership directly 248 * to waiting readers or a writer. 249 * 250 * @param rwl Reader/Writer lock. 251 */ 211 252 void rwlock_write_unlock(rwlock_t *rwl) 212 253 { … … 221 262 } 222 263 264 /** Release reader/writer lock held by reader 265 * 266 * Release reader/writer lock held by reader. 267 * Handoff reader/writer lock ownership directly 268 * to a waiting writer or don't do anything if more 269 * readers poses the lock. 270 * 271 * @param rwl Reader/Writer lock. 272 */ 223 273 void rwlock_read_unlock(rwlock_t *rwl) 224 274 { … … 234 284 235 285 236 /* 286 /** Direct handoff 287 * 288 * Direct handoff of reader/writer lock ownership 289 * to waiting readers or a writer. 290 * 237 291 * Must be called with rwl->lock locked. 238 292 * Must be called with cpu_priority_high'ed. 239 */ 240 /* 293 * 294 * @param rwl Reader/Writer lock. 295 * @param readers_only See the description below. 296 * 241 297 * If readers_only is false: (unlock scenario) 242 298 * Let the first sleeper on 'exclusive' mutex in, no matter … … 306 362 } 307 363 364 /** Release spinlock callback 365 * 366 * This is a callback function invoked from the scheduler. 367 * The callback is registered in _rwlock_read_lock_timeout(). 368 * 369 * @param arg Spinlock. 370 */ 308 371 void release_spinlock(void *arg) 309 372 {
Note:
See TracChangeset
for help on using the changeset viewer.