This makes ast_stopstream() thread-safe.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@90142
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
int ast_stream_and_wait(struct ast_channel *chan, const char *file,
const char *language, const char *digits);
-/*! Stops a stream */
-/*!
+/*!
+ * \brief Stops a stream
+ *
* \param c The channel you wish to stop playback on
+ *
* Stop playback of a stream
- * Returns 0 regardless
+ *
+ * \retval 0 always
+ *
+ * \note The channel does not need to be locked before calling this function.
*/
int ast_stopstream(struct ast_channel *c);
int ast_stopstream(struct ast_channel *tmp)
{
+ ast_channel_lock(tmp);
+
/* Stop a running stream if there is one */
if (tmp->stream) {
ast_closestream(tmp->stream);
ast_closestream(tmp->vstream);
tmp->vstream = NULL;
}
+
+ ast_channel_unlock(tmp);
+
return 0;
}