[vlc-devel] zvbi on win64

Mario Speiß 1034-135 at online.de
Sat Jan 19 21:55:14 CET 2013


On 19.01.2013 19:34, Rémi Denis-Courmont wrote:
> Le samedi 19 janvier 2013 20:06:56, Mario Speiß a écrit :
>> int
>> pthread_once (pthread_once_t * once_control, void (*init_routine) (void))
>> {
>> +#ifdef WIN64
>> +  if (ptw32_interlocked_compare_exchange == NULL)
>> +    {
>> +      ptw32_interlocked_compare_exchange =
>> ptw32_InterlockedCompareExchange;
>> +    }
>> +#endif
>
> Not sure about Windows, but this does not follow the POSIX memory coherency
> model. You'd better set the pointer statically. In fact, I don't understand
> why this needs a function pointer at all, especially not on 64-bits.

Indeed, i was happy to not see vlc crash but that solution is really not 
correct. The function pointer resolves to a practically empty function 
body which obviously is nop as it is wrapped within
#if defined(_M_IX86) in ptw32_InterlockedCompareExchange() being called 
as ptw32_interlocked_compare_exchange. That is the reason why the x86 
version of zvbi works flawless.

So for 64 bit one would need to call the attach/detach-methods (like 
x264 does) but it seems as if x264 does not make use of this feature. If 
i wrap the attach/detach the same way in modules/codec/zvbi.c i get 
unresolved symbols __imp_pthread_win32_process_attach_np etc.

It seems that the more recent version of pthreads for win32 (ie >2.9.0) 
are easier to get to work correctly with 64 bits.

I think i am not able to resolve that in a short time...

Regards,
Mario
>
>>     if (once_control == NULL || init_routine == NULL)
>>       {
>>         return EINVAL;
>>       }
>> .............
>>
>> Someone could make a patch from this to add it to
>> contrib/src/pthreads/pthreads-win64.patch
>> as i dont know how to do that.
>
> There is already a patch in the pthreads contrib package. You can use that as
> an example. It's just a regular unified diff.
>




More information about the vlc-devel mailing list