hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 52df69f9980d438fa44509dd5d679453fcdeec45
parent 35b47a26b3b1f9c98fbfffaa8cfe12a3facbca65
Author: Drew DeVault <sir@cmpwn.com>
Date:   Wed, 20 Oct 2021 11:57:42 +0200

cmd/iobus: flesh out dual bus management

Signed-off-by: Drew DeVault <sir@cmpwn.com>

Diffstat:
Mcmd/iobus/main.ha | 12+++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/cmd/iobus/main.ha b/cmd/iobus/main.ha @@ -21,9 +21,13 @@ export fn main() void = { let pollin = iobus::poll(mainbus, in, poll::event::POLLIN)!; let polluser = iobus::poll(mainbus, userfd, poll::event::POLLIN)!; - iobus::enqueue(mainbus, &pollin); + iobus::enqueue(mainbus, &pollin, &polluser); fmt::error("> ")!; + const write = iobus::write(userbus, os::stdout_file, + strings::toutf8("hi!\n"), 0)!; + iobus::submit(userbus, &write)!; + for (true) { const res = iobus::dispatch(mainbus)!; defer iobus::done(mainbus, res); @@ -42,6 +46,12 @@ export fn main() void = { iobus::busfile_drain(userfd); polluser = iobus::poll(mainbus, userfd, poll::event::POLLIN)!; iobus::enqueue(mainbus, &polluser); + + // TODO: Something more sophisticated than this + const res = iobus::dispatch(userbus)!; + iobus::done(userbus, res); + fmt::errorln("\rcompletion event received")!; + fmt::error("> ")!; }; }; };