Re: [Rails] Re: A way to share a variable across multiple httpd threads with Rails?

2011-03-10 Thread Frederick Cheung
On 9 Mar 2011, at 19:34, Chad Johnson li...@ruby-forum.com wrote: Frederick Cheung wrote in post #986539: On 9 Mar 2011, at 17:47, Chad Johnson li...@ruby-forum.com wrote: Thread.current[mycount] = count count += 1 } end This looks thread dangerous

[Rails] Re: A way to share a variable across multiple httpd threads with Rails?

2011-03-10 Thread Matt Jones
On Mar 9, 2:34 pm, Chad Johnson li...@ruby-forum.com wrote: Frederick Cheung wrote in post #986539: On 9 Mar 2011, at 17:47, Chad Johnson li...@ruby-forum.com wrote:            Thread.current[mycount] = count            count += 1          }        end This looks thread dangerous

[Rails] Re: A way to share a variable across multiple httpd threads with Rails?

2011-03-09 Thread Chad Johnson
Frederick Cheung wrote in post #986539: On 9 Mar 2011, at 17:47, Chad Johnson li...@ruby-forum.com wrote: Thread.current[mycount] = count count += 1 } end This looks thread dangerous to me - i don't think += is atomic. variable**. For instance, maybe

[Rails] Re: A way to share a variable across multiple httpd threads with Rails?

2011-03-09 Thread Robert Pankowecki (rupert)
So, regardless of whether this is a good or bad idea (I will assess that later), is there any way to directly access a shared resource object? Regardless of that: I think that passenger has a callback that is executed before new worker instance is spawned. Maybe that could somehow help you.