[vlc-devel] [PATCH 2/6] thread: add generic futex-based muteces

Rémi Denis-Courmont remi at remlab.net
Fri Feb 21 07:42:07 CET 2020


Oh, that's right. Not sure why GCC tolerates this mistake.

Le 21 février 2020 02:22:31 GMT+02:00, Marvin Scholz <epirat07 at gmail.com> a écrit :
>Hi, I did not do a full review of this, I just applied it
>and tried it out and ran into a compilation error due
>to the atomic pointer.
>
>See inline:
>
>On 20 Feb 2020, at 20:58, Rémi Denis-Courmont wrote:
>
>> This provides a common implementation of fast (non-debug),
>> error-checking (debug) and recursive muteces on top of
>> vlc_atomic_wait() and vlc_atomic_notify_one(), using Drepper's
>tristate
>> mutex algorithm.
>>
>> [ … ]
>>
>>  /**
>>   * Read/write lock.
>> @@ -343,6 +335,43 @@ typedef struct vlc_timer *vlc_timer_t;
>>   * \defgroup mutex Mutual exclusion locks
>>   * @{
>>   */
>> +#ifndef LIBVLC_DONT_WANT_MUTEX
>> +/**
>> + * Mutex.
>> + *
>> + * Storage space for a mutual exclusion lock.
>> + */
>> +typedef struct
>> +{
>> +    union {
>> +#ifndef __cplusplus
>> +        struct {
>> +            atomic_uint value;
>> +            atomic_uint recursion;
>> +            _Atomic const void *owner;
>
>I believe you meant to do
>
>    const void * _Atomic owner;
>
>here, as you want the pointer and not void itself to be
>atomic? With clang at least, _Atomic const void *owner
>does not compile:
>
>   error: _Atomic cannot be applied to incomplete type 'void'
>
>> +        };
>> +#endif
>> +        struct {
>> +            unsigned int value;
>> +            unsigned int recursion;
>> +            const void *owner;
>> +        } dummy;
>> +    };
>> +} vlc_mutex_t;
>>
>> [ … ]
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20200221/afeaec1f/attachment.html>


More information about the vlc-devel mailing list