apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Graham Leggett <minf...@sharp.fm>
Subject Re: Handholding: Locking
Date Tue, 31 Jul 2001 07:33:42 GMT
Aaron Bannert wrote:

> A mutex does simple mutual-exclusion. All accesses to the critical section
> are serialized.


> A read/write lock will allow simultaneous "readers", and will provide
> exclusive "writers". As an application developer using APR, you'd have to
> use apr_lock_acquire_rw() instead of the normal apr_lock_acquire() you
> use with a mutex, so that you can ask for a read or a write lock. What this
> gives you is finer grain control over how much parallization certain parts
> of you code may endure.

Ok - In the code I am busy porting, a shared memory cache is
implemented. When something writes to the cache, nothing else must read
or write. When something is read from the cache, anyone else may read
simultaneously without a problem. Is this a job for a read/write lock?

minfrin@sharp.fm		"There's a moon
					over Bourbon Street
View raw message