Frederick Cheung wrote in post #986539:
> On 9 Mar 2011, at 17:47, Chad Johnson <[email protected]> wrote:
>
>>            Thread.current["mycount"] = count
>>            count += 1
>>          }
>>        end
>
> This looks thread dangerous to me - i don't think += is atomic.
>> variable**. For instance, maybe whatever spawns the ruby process to
>> serve httpd process could hold the variable count in its scope, and then
>> the ruby processes spawned for httpd processes could then access that
>> variable.

Just example code I pulled from someone online. I'd never actually use
this, and my stuff would be as thread-safe as possible.

> Personally, if I had to do this, I'd these objects in a separate
> long-lived process (or processes) and have your controller actions talk
> to these processes (exactly how depends on what you'll be doing, you
> might consider drb, message queues etc)

You're talking about something like a daemon to act as a proxy, and
I'd communicate with it via some protocol I define? That was my thought
too, but it's extra work, and I was trying to avoid spending the extra
time on this and just use the FTP connection directly.

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?

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to