On Wed, 15 May 2019 12:09:19 +0200 <to...@tuxteam.de> wrote: > On Mon, May 13, 2019 at 06:54:38PM +0800, Nala Ginrut wrote: > > Hi folks! > > Here's a patch to add current-suspendable-io-status: > > Its result is a pair: (finished-bytes . rest-bytes) > > Sorry for this possibly dumb question, but... is there a way > to be non-blocking even if there are no readable/writable > bytes at all? Or would one have to do multi-threading (and > let the single threads [1] block) for that? > > Thanks
With guile-2.2/3.0, you install suspendable ports and parameterize current-read-waiter and/or current-write-waiter. There is an example here: https://github.com/ChrisVine/guile-a-sync2/blob/master/a-sync/await-ports.scm fibers does something similar. See also https://www.gnu.org/software/guile/docs/master/guile.html/Non_002dBlocking-I_002fO.html#Non_002dBlocking-I_002fO Chris