Mailboxes with Stackless
In my stackless application I'd like to have Erlang style message box queues. Instead of mandating that sending tasklets are blocked until the receiving tasklet is ready to receive, I'd like to have the sending tasklet to queue up the message in the receiver's message box, and be able to wake the receiver if it's sleeping.
The sending tasklet should be able to send a message and then contin开发者_开发技巧ue executing, regardless of the state of the receiving tasklet.
I'm sure there's a way to do this, I just haven't found it yet...
This may not be exactly what you are looking for, but still worth a shot:
gevent is a Python library that provides high-level APIs over greenlets, which are similar to tasklets (actually, it's a spin-off of Stackless Python. There are some differences, though: you don't need a special interpreter and a few more).
gevent provides an API similar to Python's native Queue - i.e. you can put objects in it, read from it (blocking or non-blocking, with or without timeouts).
精彩评论