[vlc-devel] [PATCH 1/3] os2: implement vlc_once()
KO Myung-Hun
komh78 at gmail.com
Tue May 22 05:31:14 CEST 2018
Thanks!
Thomas Guillem wrote:
> Ah yes, just merged.
>
> On Fri, May 18, 2018, at 11:23, KO Myung-Hun wrote:
>> Ping ?
>>
>> KO Myung-Hun wrote:
>>>
>>> Updated.
>>>
>>> Rémi Denis-Courmont wrote:
>>>> IMU, compare-exchange with comparand equal to assignment value makes no sense, since it's just an over-comlicated load.
>>>>
>>>> Le 10 mai 2018 14:41:46 GMT+02:00, KO Myung-Hun <komh78 at gmail.com> a écrit :
>>>>> ---
>>>>> include/vlc_threads.h | 6 ++++++
>>>>> src/os2/thread.c | 20 ++++++++++++++++++++
>>>>> 2 files changed, 26 insertions(+)
>>>>>
>>>>> diff --git a/include/vlc_threads.h b/include/vlc_threads.h
>>>>> index 508ddbc001..b0891ac88c 100644
>>>>> --- a/include/vlc_threads.h
>>>>> +++ b/include/vlc_threads.h
>>>>> @@ -125,6 +125,12 @@ typedef struct
>>>>> #define VLC_STATIC_COND { NULLHANDLE, 0, NULLHANDLE, 0 }
>>>>> #define LIBVLC_NEED_SEMAPHORE
>>>>> #define LIBVLC_NEED_RWLOCK
>>>>> +typedef struct
>>>>> +{
>>>>> + unsigned done;
>>>>> + vlc_mutex_t mutex;
>>>>> +} vlc_once_t;
>>>>> +#define VLC_STATIC_ONCE { 0, VLC_STATIC_MUTEX }
>>>>> typedef struct vlc_threadvar *vlc_threadvar_t;
>>>>> typedef struct vlc_timer *vlc_timer_t;
>>>>>
>>>>> diff --git a/src/os2/thread.c b/src/os2/thread.c
>>>>> index 3b435bfad8..000c3068b3 100644
>>>>> --- a/src/os2/thread.c
>>>>> +++ b/src/os2/thread.c
>>>>> @@ -429,6 +429,26 @@ int vlc_cond_timedwait_daytime (vlc_cond_t
>>>>> *p_condvar, vlc_mutex_t *p_mutex,
>>>>> return vlc_cond_wait_common (p_condvar, p_mutex, ulTimeout);
>>>>> }
>>>>>
>>>>> +void vlc_once(vlc_once_t *once, void (*cb)(void))
>>>>> +{
>>>>> + /* once->done is 0 ? */
>>>>> + if( __atomic_cmpxchg32( &once->done, 0, 0 ))
>>>>> + {
>>>>> + vlc_mutex_lock( &once->mutex );
>>>>> +
>>>>> + /* still once->done is 0 ? */
>>>>> + if( __atomic_cmpxchg32( &once->done, 0, 0 ))
>>>>> + {
>>>>> + cb();
>>>>> +
>>>>> + /* set once->done to 1 */
>>>>> + __atomic_xchg( &once->done, 1 );
>>>>> + }
>>>>> +
>>>>> + vlc_mutex_unlock( &once->mutex );
>>>>> + }
>>>>> +}
>>>>> +
>>>>> /*** Thread-specific variables (TLS) ***/
>>>>> struct vlc_threadvar
>>>>> {
>>>>> --
>>>>> 2.13.3
>>>>>
>>>>> _______________________________________________
>>>>> vlc-devel mailing list
>>>>> To unsubscribe or modify your subscription options:
>>>>> https://mailman.videolan.org/listinfo/vlc-devel
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> vlc-devel mailing list
>>>> To unsubscribe or modify your subscription options:
>>>> https://mailman.videolan.org/listinfo/vlc-devel
>>>
>>>
>>>
>>> _______________________________________________
>>> vlc-devel mailing list
>>> To unsubscribe or modify your subscription options:
>>> https://mailman.videolan.org/listinfo/vlc-devel
>>
>> --
>> KO Myung-Hun
>>
>> Using Mozilla SeaMonkey 2.7.2
>> Under OS/2 Warp 4 for Korean with FixPak #15
>> In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM
>>
>> Korean OS/2 User Community : http://www.os2.kr/
>>
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
--
KO Myung-Hun
Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM
Korean OS/2 User Community : http://www.os2.kr/
More information about the vlc-devel
mailing list