Welcome! Log In Create A New Profile

Advanced

Is this thread bug?

February 22, 2012 02:00AM
hello,everyone:
I have to use nginx's muti-thread model. Presently, i am using and modifying it. But i have some problems about nginx's thread processing:
(1) in funcion "ngx_worker_thread_cycle", there is such codes which i think is a mistake:
if (ngx_event_thread_process_posted(cycle) == NGX_ERROR) {
return (ngx_thread_value_t) 1;
}

if (ngx_event_thread_process_posted(cycle) == NGX_ERROR) {
return (ngx_thread_value_t) 1;
}
==>why call twice?
(2)in function "ngx_event_expire_timers", lock problem as followings:
ngx_mutex_lock(ngx_event_timer_mutex);

root = ngx_event_timer_rbtree.root;

if (root == sentinel) {
return;
}
==>return without call ngx_mutex_unlock?
(3) in function "ngx_epoll_process_events",lock problem too:
before the code "call rev->handler(rev);" ,it has call "ngx_mutex_lock(ngx_posted_events_mutex)",but the handler recursively call other functions wich may need the lock("ngx_posted_events_mutex") too,then deadlock happens.
I just simply modify it as follows:
ngx_mutex_unlock(ngx_posted_events_mutex); //xxx
rev->handler(rev);
ngx_mutex_lock(ngx_posted_events_mutex); //xxx
===>whether this modifying will bring on other unconspicuous problems?

Is there any solutions for nginx’s muti-threads using?Is there any plan to support muti-threads?about when?
I am looking forward to your reply.
Thanks a lot.
Subject Author Posted

Is this thread bug?

feneyer February 22, 2012 02:00AM

Re: Is this thread bug?

Maxim Dounin February 22, 2012 08:54AM

Re: Is this thread bug?

feneyer February 22, 2012 08:26PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 244
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready