a little bug in ngx_event_expire_timers

Pass86 pass86 at gmail.com
Fri Jul 20 10:35:00 UTC 2012


not using lock, why coding?

发自我的 iPhone

在 2012-7-20,14:07,Ruslan Ermilov <ru at nginx.com> 写道:

> On Fri, Jul 20, 2012 at 12:11:51PM +0800, Joy zhou wrote:
>>   hi everyone:
>>     
>>     I have found a little bug at method ngx_event_expire_timers  of  the
>>   file "src/event/ngx_event_timer.c "
>>     
>>     
>>        84     for ( ;; ) {
>>        85
>>        86         ngx_mutex_lock(ngx_event_timer_mutex);
>>        87
>>        88         root = ngx_event_timer_rbtree.root;
>>        89
>>        90         if (root == sentinel) {
>>        91             return;
>>        92         }
>>       
>>                  [...]
>>               }
>>               
>>      The above code should add 
>>   "ngx_mutex_unlock(ngx_event_timer_mutex);" at 90 line,
>>      Because the ngx_event_timer_mutex has locked at begin , but returned
>>   without unlock , is it right?       
> 
> Only theoretically.  Practically, ngx_mutex_lock() is a no-op in nginx.
> 
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel



More information about the nginx-devel mailing list