thiell/test — Issue #21: Add Inter Task Communication API
Author: thiell
Created: 2012-03-03 16:28:23+00:00
State: closed
Labels: Lib

Currently, each ClusterShell task is independent, running in a separate thread, and inter-task communication is not supported. User could add their own synchronization or communication system but it may be tricky to implement without an access to Engine internals.

This ticket follows the addition of Inter Task/Engine Communication API, probably like a sort of thread mailboxes handled by the Engine at next loop.
This will allow task1 to perform task2.abort(), here is an idea of how it could perform:

{{{
task1
-----
task2.abort()
if task2 != task_self():
task2.engine.mbox_post("abort")
task_mbox_wait("abort_ok") (current task1 waits for "abort_ok" msg)

task2
-----
poll()
-> event read on special mailbox FD
-> "abort" msg received from task1
self.abort()
task1.engine.mbox_post("abort_ok")

}}}