Rev 43 | Rev 45 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 43 | Rev 44 | ||
|---|---|---|---|
| Line 254... | Line 254... | ||
| 254 | any possibility of starvation. In fact, rwlocks use a mutex rather than |
254 | any possibility of starvation. In fact, rwlocks use a mutex rather than |
| 255 | a bare wait queue. This mutex is called <emphasis>exclusive</emphasis> |
255 | a bare wait queue. This mutex is called <emphasis>exclusive</emphasis> |
| 256 | and is used to synchronize writers. The writer's lock operation, |
256 | and is used to synchronize writers. The writer's lock operation, |
| 257 | <emphasis>rwlock_write_lock_timeout</emphasis>, simply tries to acquire |
257 | <emphasis>rwlock_write_lock_timeout</emphasis>, simply tries to acquire |
| 258 | the exclusive mutex. If it succeeds, the writer is granted the rwlock. |
258 | the exclusive mutex. If it succeeds, the writer is granted the rwlock. |
| 259 | However, if the operation fails, the writer must check for potential |
259 | However, if the operation fails (e.g. times out), the writer must check |
| 260 | readers at the head of the list of sleeping threads associated with the |
260 | for potential readers at the head of the list of sleeping threads |
| 261 | mutex's wait queue and proceed according to the procedure outlined |
261 | associated with the mutex's wait queue and proceed according to the |
| 262 | above.</para> |
262 | procedure outlined above.</para> |
| 263 | 263 | ||
| 264 | <para>The exclusive mutex plays an important role in reader |
264 | <para>The exclusive mutex plays an important role in reader |
| 265 | synchronization as well. However, a reader doing the reader's lock |
265 | synchronization as well. However, a reader doing the reader's lock |
| 266 | operation, <emphasis>rwlock_read_lock_timeout</emphasis>, may bypass |
266 | operation, <emphasis>rwlock_read_lock_timeout</emphasis>, may bypass |
| 267 | this mutex when it detects that:</para> |
267 | this mutex when it detects that:</para> |