pkg event = type hub(@ev) = struct /* opaque */ ;; type sendtag = void# /* blocks until an event is ready, then returns it. */ generic wait : (h : hub(@ev)# -> @ev#) /* * chains one event source into another: when an event on slave 's' is * available, cvt(wait(s)) is fired on the master. */ generic chain : (m : hub(@mev)#, s : hub(@sev)#, cvt : (e : @sev -> @mev) -> void) /* adds a source; the source should block until the event is ready. */ generic add : (h : hub(@ev)#, fn : (-> @ev) -> void) /* adds an fd-based source; this may be more convenient on some systems. */ generic addfd : (h : hub(@ev)#, fd : std.fd, fn : (fd : std.fd -> @ev) -> void) ;;