Hi,

On Tue, Dec 6, 2011 at 4:32 PM, Sergey Radionov <[email protected]> wrote:

> 2011/12/7 Luca Barbato <[email protected]>
>
>> On 06/12/11 16:18, Sergey Radionov wrote:
>>
>>> Reason for making this patch is https://trac.videolan.org/vlc/**
>>> ticket/5571 <https://trac.videolan.org/vlc/ticket/5571>
>>>
>>> Problem is that under windows, when multiple threads waiting on same
>>> semaphore, and when ReleaseSemaphore called, it impossible to predict
>>> wich
>>> thread will wake up...
>>>
>>>
>> I'm wondering if is possible to simplify a little the solution.
>> If you are on irc I'd like you to explain me better how it works.
>>
>> Meanwhile I noticed that there are some formal issue (tabs, missing
>> spaces and other minor things), that should be taken care.
>>
> I will be glad to hear your recommendations.
>

>      pthread_mutex_lock(&c->current_job_lock);
> -    self_id = c->current_job++;
> +    self_id = (c->running_threads)++;

Omit the brackets.

>      for (;;){
> -        while (our_job >= c->job_count) {
> -            if (c->current_job == thread_count + c->job_count)
> +        do{
> +            if ( !(c->job_count) )

Omit the spaces and brackets.

>              pthread_cond_wait(&c->current_job_cond,
&c->current_job_lock);
> -            our_job = self_id;
> +            if(c->current_job < c->job_count)

Space between "if" and "(".

> +                our_job = (c->current_job)++;

Omit brackets.

>              if (c->done) {
> +                --(c->running_threads);

Omit brackets.

> -        }
> +        }while (our_job >= c->job_count);

Space between "}" and "while".


>          pthread_mutex_lock(&c->current_job_lock);
> -        our_job = c->current_job++;
> +
> +        --(c->job_count);

Omit brackets.

Ronald
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to