apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Bannert <aa...@ebuilt.com>
Subject Re: Handholding: Locking
Date Tue, 31 Jul 2001 07:19:04 GMT
On Tue, Jul 31, 2001 at 09:06:49AM +0200, Graham Leggett wrote:
> > This is for a intraprocess mutex.  The flags in apr_lock.h can tell you
> > how to do other types of locks.
> What is the difference between a APR_MUTEX lock and an APR_READWRITE
> lock?

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.


View raw message