Here is the sample code. http://pastebin.com/cjFM1AR1
The global variable p is like a store holding some values. If there is an
exception, I want to change the store value.
Without the sleep function, c2 will not be executed because p will retain
the value 2 instead of the new value 3
In the real program, if a request comes in, we spawn a new greenlet thread
to do the heavy stuff. Returns a json response back to user saying it's
processing. Next time user comes back and asks we can check the status of
the thread (is it successful? ready? exception?), or we can directly check
the store and see what's the latest response ("All the machines are
busy!!") for example.
In another words, the link_exeception should be called and finished in the
background. Can gevent do that? It seems like I have to manually switch the
greenlet thread.
Thanks.