[vlc-devel] [PATCH] MMS stream pausing

bl4 bl4 at playker.info
Fri Jun 13 20:46:02 CEST 2008


Rémi Denis-Courmont wrote:
> Le vendredi 13 juin 2008 02:23:00 bl4, vous avez écrit :
>   
>> +    while (!p_thread->b_die) {
>> +        if (p_thread->b_paused) {
>> +            if (!p_thread->last_ping_time) {
>> +                p_thread->last_ping_time = time(NULL);
>> +            } else if (time(NULL) > p_thread->last_ping_time + 10) {
>> +                mms_CommandSend( p_access, 0x1b, 0, 0, NULL, 0 );
>> +                p_thread->last_ping_time = time(NULL);
>>     
>
> Looks suspiciously lock-free?
>   

What exactly should be locked here? I'm not very familiar with threads, 
it looks to me that b_paused is the only thing shared between threads 
and no race condition occurs. Maybe it's possible that b_paused is read 
and written at the same time, should access to b_paused be locked then? 
I looked at other modules which use threads but I can't figure it out.

-- 
bl4




More information about the vlc-devel mailing list