set send_this [ json::write array {*}$to_send ]
puts $options(-send_to_fh) $send_this
}
+
+ method remote_object {id} {
+ return [ten::handle %AUTO% -connection $self -id $id]
+ }
+
}
snit::type ten::future {
vwait "${selfns}::is_ready"
}
+ method await_get {} {
+ $self retain
+ $self await_ready
+ if [$self is_failure] {
+ set err [$self failure]
+ $self free
+ error $err
+ }
+ set res [$self get]
+ $self free
+ return $res
+ }
+
method retain {} {
incr retain_count
}
}
} else {
if [llength $options(-on_line_call)] {
- while {[llength [set line [gets $chan]]] > 0} {
+ while {[string length [set line [gets $chan]]] > 0} {
eval [concat $options(-on_line_call) [ list $line ]]
}
}
}
}
+snit::type ten::handle {
+ option -connection
+ option -id
+
+ method call {name args} {
+ return [[$self start $name {*}$args] await_get]
+ }
+
+ method start {name args} {
+ $options(-connection) send call [json::write string $options(-id)] 0 [json::write string $name] {*}$args
+ }
+}
+
package provide ten 0.0.1