What is it you're trying to do? Deliberately causing your requests to
block each other doesn't sound very scalable. Also, sleeping for only
1 millisecond will likely eat a ton of CPU while it spins waiting for
the lock.

It's hard to comment without knowing what you're trying to do. Maybe
if you can explain a little more about what it is, people in this
group will be able to suggest a better way.

On Jan 25, 2:33 am, Iap <iap...@gmail.com> wrote:
> I can not find the lock feature of memcache.
> It's easy to set a flag somewhere in the memcache (got Lock)
> The problem is: how the other request
> when it hits the locked flag to wait for the lock to be released.
>
> A quick and very drity solution is (maybe not even work, just for concept):
>
> client = memcache.Client()
> locked = client.get('lock')
> while locked:
>      ## wait for another request to release the lock
>      time.sleep(1)
>      locked = client.get('lock')
> locked = client.set('lock',1)
> .....
> locked = client.set('lock',0)
>
> Is there better way than "while ..sleep?" to block the request for a moment?

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to