asyncoro, part of dispy package, is a framework for developing (concurrent) programs with asynchronous sockets and coroutines. The coroutines should use ‘yield’ with tasks that take time to complete, such as waiting for I/O completion, or sleep. Each yield statement gives control to asyncoro’s scheduler, which interleaves executions of coroutines, similar to the way an operating system executes multiple processes. asyncoro includes polling mechanisms epoll, kqueue and poll, and Windows I/O Completion Ports (IOCP) for high performance and scalability. asyncoro can be used independently of dispy.


AsynCoro and associated classes in file provide framework for developing programs with coroutines and asynchronous I/O for sockets. Unlike with the case of callbacks used in event-based frameworks, the programs developed with asyncoro will have same logic as python progorams with synchronous sockets and threads, except for converting sockets to asynchronous model with AsynCoroSocket class, ‘yield’ when waiting for completion of tasks (i.e., socket operations, sleep and waiting on CoroCondition) and using CoroLock, CoroCondition in place of thread locking. Tehcnically, CoroLock is not needed (as there is no forced preemption with coroutines and at most one coroutine is executing at anytime), but if one wants to maintain same program for both synchronous and asynchronous models, it would be simple to interchange threading.Lock and CoroLock, threading.Condition and CoroCondition, and a few syntactic changes.

Download Latest Version : (76.1 KB) |
Find Other version |
Read more in here :