]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merge a change from team/russell/chan_refcount ...
authorRussell Bryant <russell@russellbryant.com>
Thu, 29 Nov 2007 00:06:08 +0000 (00:06 +0000)
committerRussell Bryant <russell@russellbryant.com>
Thu, 29 Nov 2007 00:06:08 +0000 (00:06 +0000)
This makes ast_stopstream() thread-safe.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@90142 65c4cc65-6c06-0410-ace0-fbb531ad65f3

include/asterisk/file.h
main/file.c

index 69229d406c13faeaa3706dc2527d519f6609f977..cada2341371820bae81ea4c94a9580c6b2ebe837 100644 (file)
@@ -172,11 +172,16 @@ int ast_streamfile(struct ast_channel *c, const char *filename, const char *pref
 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);
 
index 65dd5e1b91fbbff81339bc76e7c6f54d4f28c77d..fcdc3574646e5885f803857d67f0f8dc1a458a22 100644 (file)
@@ -136,6 +136,8 @@ int ast_format_unregister(const char *name)
 
 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);
@@ -148,6 +150,9 @@ int ast_stopstream(struct ast_channel *tmp)
                ast_closestream(tmp->vstream);
                tmp->vstream = NULL;
        }
+
+       ast_channel_unlock(tmp);
+
        return 0;
 }