[asterisk-dev] ast_mutex_lock
    Tilghman Lesher 
    tilghman at mail.jeffandtilghman.com
       
    Mon Oct 23 09:17:02 MST 2006
    
    
  
On Monday 23 October 2006 02:26, Alexandr Olekhnovich wrote:
> Hello all,
> I'm developing a billing module for asterisk and I've
> to use connection pooling. But it doesn't work as well as I need. So
> I am under apprehension of 2 functions. They are ast_mutex_lock,
> ast_mutex_unlock.
> I know partly what they are for. But can anybody explain what they
> are really for and where can I use them? Thanx.
They are usually just defines for pthread_mutex_lock and
pthread_mutex_unlock, unless you are debugging, in which case they
are wrappers for the above functions, with extra debugging code.
They need to be used in any place where you might have two different
threads applying changes to the same block of memory, in order to avoid
race conditions.
-- 
Tilghman
    
    
More information about the asterisk-dev
mailing list