Posted to tcl by pooryorick at Tue May 24 18:22:09 GMT 2016view raw
- package require {ycl coro relay}
- namespace import [yclprefix]::coro::relay
- dict set tasks [relay call 0 cl::Buffer copy $a] 1
- dict set tasks [relay call 0 cl::Buffer copy $b] 2
- for {set i 0} {$i < 2} {incr i} {
- set device_buf [relay receive]
- catch {relay receive} result options
- set t [dict get tasks [dict get $options -id]]
- kernel_$t bind $device_buf
- dict set tasks2 [relay call kernel_$t execute] $t
- }
- for {set i 0} {$i < 2} {incr i} {
- catch {relay receive} result options
- set result_[dict get $tasks2 [dict get $options -id]] $result
- }
- do something with $result_1 $result_2