You should not start a thread from a web2py thread (without lots of
caveats).

Massimo

On Jun 3, 4:46 pm, Juan <sor...@gmail.com> wrote:
> Hi
> I've made a web2py application that uses AJAX long polling for
> bringing content to the browser at realtime, but in order to optimize
> it I want a request to be locked until some event ocurrs so the AJAX
> request function does not need to do periodic polling (reducing cpu
> usage and latency). Is there any way to archieve something like this?
>
> I know the use of threading in web2py is disencouraged but this is
> just an example of how it would be, here "lock" function should not
> return until "release" function is called:
>
> [code]
> import threading
> e = threading.Event()
>
> def lock():
>     session.forget()
>     session._unlock(response)
>     e.wait(60)
>     return 'ready'
>
> def release():
>     e.set()
>     return 'done'
> [/code]
>
> thanks
> Juan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to