# Is this thread bug?

**URL:** <https://www.ruby-forum.com/t/is-this-thread-bug/217130>\
**Category:** NGINX\
**Created:** [February 22, 2012, 8:01am UTC](https://www.ruby-forum.com/t/is-this-thread-bug/217130 "2012-02-22T08:01:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [February 22, 2012, 8:01am UTC](https://www.ruby-forum.com/t/is-this-thread-bug/217130/1 "2012-02-22T08:01:06Z")

</div>

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.

Posted at Nginx Forum:

> **[Is this thread bug?](https://forum.nginx.org/read.php?2,222829,222829#msg-222829)**
>
> 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...

---

<div class="post-metadata">

**Author:** ![feneyer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/c5a1d2/32.png) [@feneyer](https://www.ruby-forum.com/u/feneyer)\
**Post date:** [February 22, 2012, 2:53pm UTC](https://www.ruby-forum.com/t/is-this-thread-bug/217130/2 "2012-02-22T14:53:37Z")

</div>

Hello!

On Wed, Feb 22, 2012 at 02:00:11AM -0500, feneyer wrote:

> 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:

[…]

Threads support is obsolete, broken and should be removed. Just  
ignore it.

Maxim D.

---

<div class="post-metadata">

**Author:** ![feneyer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/c5a1d2/32.png) [@feneyer](https://www.ruby-forum.com/u/feneyer)\
**Post date:** [February 23, 2012, 2:26am UTC](https://www.ruby-forum.com/t/is-this-thread-bug/217130/3 "2012-02-23T02:26:47Z")

</div>

Hello, Maxim :  
I do need to use nginx’s muti-thread model, is there any suggestion  
for modifying?  
Looking forward.

feneyer

Posted at Nginx Forum:

> **[Re: Is this thread bug?](https://forum.nginx.org/read.php?2,222829,222886#msg-222886)**
>
> 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...
