Tcl Source Code

Artifact [41e86c26b7]
Login

Artifact 41e86c26b733a3d8e73168a70a433e02b1fe9933:

Attachment "rctest.tcl" to ticket [2918110fff] added by sbron 2009-12-20 21:09:55.
namespace eval foo {
    namespace ensemble create -subcommands {initialize finalize watch write}
}

proc foo::initialize {id mode} {
    return [namespace ensemble configure foo -subcommands]
}

proc foo::watch {id spec} {
    if {"write" in $spec} {
       	chan postevent $id write
    }
}

proc contact {fd} {
    chan event $fd writable {}
}

set fd [chan create write foo]
chan event $fd writable [list contact $fd]