[asterisk-dev] AST_LIST_LOCK/UNLOCK

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Mon Jan 19 14:56:49 CST 2009


On Monday 19 January 2009 02:15:16 am Chandrakant Solanki wrote:
> I have doubt regarding use of AST_LIST_LOCK / UNLOCK..
>
> What is the actual purpose to lock the conference...??

To ensure that if two different threads attempt to alter the structure, it
ends up in a consistent state.  Remember that at any time, even in the middle
of copying a string, a thread can be suspended and another thread given
control.  Without locking, the concluding state may not be certain.

> And is it necessary to use AST_LIST_LOCK / UNLOCK while I update something
> (like flags, markedusers) into ast_conference structure...

Given that it does not have a general lock for structure elements, yes.

-- 
Tilghman



More information about the asterisk-dev mailing list