Thread.current

Jimmy Soho jimmy.soho at gmail.com
Tue Jan 11 17:52:12 EST 2011


Hi,

Some more questions still:

It seems a worker uses the exact same thread to handle each request.

Is that guaranteed to happen for the lifetime of a worker? Or are
there cases where a unicorn worker might spin a new thread to handle
the next requests?

If the same thread is always used, isn't that a potential issue when
programmers use thread local variables, which are not reset at the
next request?  (I know, the usage of thread local variables is not
recommended, but take a random rails project, go into their $GEM_HOME
and do grep -r Thread.current . , see what I mean..)


Cheers,
Jimmy



On Sat, Jan 8, 2011 at 4:54 PM, Jimmy Soho <jimmy.soho at gmail.com> wrote:
>>>> However, the Thread.current value within those parallel requests is
>>>> always the same.
>
> EW> Just a lucky coincidence :)
>
> I guess. Got confused there for a moment because of it. :)  Using $$
> made things more clear.
>
>
>
> Thanks
>
> Jimmy
>


More information about the mongrel-unicorn mailing list