diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-06-28 12:39:26 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-06-28 12:44:03 +0200 |
commit | 2236456715767a297166040c8f7fa10cb980ed35 (patch) | |
tree | a01ed0ff259ee313c043f21c6abe8b5b899036aa /libavfilter | |
parent | 16310e36d9405b8d7d0da1273b03bec3adfec153 (diff) | |
download | ffmpeg-2236456715767a297166040c8f7fa10cb980ed35.tar.gz |
avfilter/avfilter: Make avfilter_register() thread safe
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/avfilter.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 9e3977cca0..c3228cd855 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/atomic.h" #include "libavutil/avassert.h" #include "libavutil/avstring.h" #include "libavutil/channel_layout.h" @@ -465,11 +466,11 @@ int avfilter_register(AVFilter *filter) || (!input->start_frame && !input->end_frame)); } - while (*f) - f = &(*f)->next; - *f = filter; filter->next = NULL; + while(avpriv_atomic_ptr_cas((void * volatile *)f, NULL, filter)) + f = &(*f)->next; + return 0; } |