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 <[email protected]> wrote:

>
> we can encapsulate the body of the function in thread lock.
>
> On Sep 13, 10:53 am, zahariash <[email protected]> wrote:
> > Ups, in my patch if statement isn't thread safe...
> >
> > On 13 Wrz, 17:35, zahariash <[email protected]> wrote:
> >
> > > I think it is.
> >
> > > On 13 Wrz, 17:31, mdipierro <[email protected]> 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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to