progrium / ginkgo

Python service microframework
http://ginkgo.readthedocs.org
MIT License
325 stars 48 forks source link

Context should abstract sleep() #25

Closed progrium closed 12 years ago

progrium commented 12 years ago

Since you should be using a Service's interface to create greenthreads (spawn, spawn_later), we've almost abstracted the core gevent API. However, we still commonly call gevent.sleep() to yield or wait for a period. If we abstract this, we can later use a common interface whether you're using OS threads or greenlets. sleep() shouldn't live on Service because it's more global. However, I'd like to avoid having global functions on, say, the gservice module. So perhaps it makes most sense on Context.

progrium commented 12 years ago

AsyncManager in 0.5.0 does this.