Re: [FFmpeg-devel] [PATCH v3 2/3] libavcodec/utils.c: simplify avcodec locking with atomics

2017-11-25 Thread Rostislav Pehlivanov
On 25 November 2017 at 19:48, Rostislav Pehlivanov wrote: > > > On 25 November 2017 at 18:40, James Almer wrote: > >> On 11/25/2017 2:01 PM, Rostislav Pehlivanov wrote: >> > Also makes it more robust than using volatiles. >> > >> > Signed-off-by:

Re: [FFmpeg-devel] [PATCH v3 2/3] libavcodec/utils.c: simplify avcodec locking with atomics

2017-11-25 Thread Rostislav Pehlivanov
On 25 November 2017 at 18:40, James Almer wrote: > On 11/25/2017 2:01 PM, Rostislav Pehlivanov wrote: > > Also makes it more robust than using volatiles. > > > > Signed-off-by: Rostislav Pehlivanov > > --- > > libavcodec/internal.h | 1 - > >

Re: [FFmpeg-devel] [PATCH v3 2/3] libavcodec/utils.c: simplify avcodec locking with atomics

2017-11-25 Thread James Almer
On 11/25/2017 2:01 PM, Rostislav Pehlivanov wrote: > Also makes it more robust than using volatiles. > > Signed-off-by: Rostislav Pehlivanov > --- > libavcodec/internal.h | 1 - > libavcodec/utils.c| 12 ++-- > 2 files changed, 6 insertions(+), 7 deletions(-) >

Re: [FFmpeg-devel] [PATCH v3 2/3] libavcodec/utils.c: simplify avcodec locking with atomics

2017-11-25 Thread James Almer
On 11/25/2017 3:07 PM, Clément Bœsch wrote: > On Sat, Nov 25, 2017 at 05:01:56PM +, Rostislav Pehlivanov wrote: > [...] >> -volatile int ff_avcodec_locked; >> +static atomic_bool ff_avcodec_locked; >> static atomic_int entangled_thread_counter = ATOMIC_VAR_INIT(0); >> static void

Re: [FFmpeg-devel] [PATCH v3 2/3] libavcodec/utils.c: simplify avcodec locking with atomics

2017-11-25 Thread Clément Bœsch
On Sat, Nov 25, 2017 at 05:01:56PM +, Rostislav Pehlivanov wrote: [...] > -volatile int ff_avcodec_locked; > +static atomic_bool ff_avcodec_locked; > static atomic_int entangled_thread_counter = ATOMIC_VAR_INIT(0); > static void *codec_mutex; > static void *avformat_mutex; > @@ -1937,6

[FFmpeg-devel] [PATCH v3 2/3] libavcodec/utils.c: simplify avcodec locking with atomics

2017-11-25 Thread Rostislav Pehlivanov
Also makes it more robust than using volatiles. Signed-off-by: Rostislav Pehlivanov --- libavcodec/internal.h | 1 - libavcodec/utils.c| 12 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/libavcodec/internal.h b/libavcodec/internal.h index