csp (package)

What csp
Where https://github.com/securitykiss-com/csp/
Description A Golang-inspired (CSP) concurrency library for Tcl.
Documentation https://securitykiss.com/resources/tutorials/csp_project/csp.html
Updated 2015-07-29
License MIT

Code example

# From https://securitykiss.com/resources/tutorials/csp_project/csp.html
proc sender1 {ch} {
    foreach i {1 2 3 4} {
        puts "Sending $i"
        $ch <- $i
    }
    puts "Closing channel"
    $ch close
}
 
proc receiver1 {ch} {
    while 1 {
        puts "Receiving [<- $ch]"
    }
}
 
# create unbuffered (rendez-vous) channel
channel ch
go sender1 $ch
go receiver1 $ch
 
vwait forever

See Also

  • The CSP page catalogues a number of CSP/actor-model related packages.
  • tcl-hacks includes a re-implementation of this package using TclOO

Discussion