If I have a singleton class (by using the Singleton mixin), I understand
it's thread-safe in that it ensures only a single instance of this class
will be created (by putting a mutex around the instance method).  BUT
(in theory), the instance methods of my singleton instance could be
accessed concurrently by various threads, thus causing a concurrency
issue.  Right?

BUT Rails is essentially single-threaded (only a single request
processed at a time), so if I have only a single call to my singleton
instance method per http request, then it should be impossible to get
concurrency problems with it.  Right?

If I have a cluster 4 servers, then I could have as many as 4 instances
of my singleton created.  But that's OK -- each instance will have its
own io it writes to.  What I don't want is 20 requests coming in at the
same time and all trying to use the singleton to write at the exact same
time.

Are my questions clear enough to answer?

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