[asterisk-dev] Accessing a channel from different threads

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Mon Oct 8 15:27:56 CDT 2007


On Monday 08 October 2007 11:58, Dmitry Andrianov wrote:
> Just curious, is there any protection against channel to be destroyed
> (freed) between the moment I've got reference to it and managed to lock
> chan->lock ? Or is there a coding guidelines making it impossible?

If you have any doubt whatsoever, then you should use the channel finding
API specified in include/asterisk/channel.h (i.e.
ast_get_channel_by_name_locked) to ensure that the channel still exists
by the time you can get a lock on it.

-- 
Tilghman



More information about the asterisk-dev mailing list