You don't need the thread lock over the whole function: try: return MemcacheClient.__mc_instance else: lock() if not hasattr(MemcacheClient, '__mc_instance'): MemcacheClient.__mc_instance = _MemcacheClient(*a, **b) unlock() return MemcacheClient.__mc_instance
On Sun, Sep 13, 2009 at 8:03 PM, mdipierro <mdipie...@cs.depaul.edu> wrote: > > we can encapsulate the body of the function in thread lock. > > On Sep 13, 10:53 am, zahariash <karra...@gmail.com> wrote: > > Ups, in my patch if statement isn't thread safe... > > > > On 13 Wrz, 17:35, zahariash <karra...@gmail.com> wrote: > > > > > I think it is. > > > > > On 13 Wrz, 17:31, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > > > I think is excellent as long as Memcache is thread safe and I assume > > > > it is. > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---