mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-24 12:20:20 +02:00
Support for non-blocking I/O
* doc/ref/api-io.texi (I/O Extensions): Document read_wait_fd / write_wait_fd members. (Non-Blocking I/O): New section. * libguile/fports.c (fport_read, fport_write): Return -1 if the operation would block. (fport_wait_fd, scm_make_fptob): Add read/write wait-fd implementation. * libguile/ports-internal.h (scm_t_port_type): Add read_wait_fd / write_wait_fd. * libguile/ports.c (default_read_wait_fd, default_write_wait_fd): New functions. (scm_make_port_type): Initialize default read/write wait fd impls. (trampoline_to_c_read, trampoline_to_scm_read) (trampoline_to_c_write, trampoline_to_scm_write): To Scheme, a return of #f indicates EWOULDBLOCk. (scm_set_port_read_wait_fd, scm_set_port_write_wait_fd): New functions. (port_read_wait_fd, port_write_wait_fd, scm_port_read_wait_fd) (scm_port_write_wait_fd, port_poll, scm_port_poll): New functions. (scm_i_read_bytes, scm_i_write_bytes): Poll if the read or write would block. * libguile/ports.h (scm_set_port_read_wait_fd) (scm_set_port_write_wait_fd): Add declarations. * module/ice-9/ports.scm: Shunt port-poll and port-{read,write}-wait-fd to the internals module. * module/ice-9/sports.scm (current-write-waiter): (current-read-waiter): Implement. * test-suite/tests/ports.test: Adapt non-blocking test to new behavior. * NEWS: Add entry.
This commit is contained in:
parent
8b6f4df3f4
commit
534139e458
9 changed files with 344 additions and 42 deletions
4
NEWS
4
NEWS
|
@ -38,6 +38,10 @@ is equivalent to an unbuffered port. Ports may set their default buffer
|
|||
sizes, and some ports (for example soft ports) are unbuffered by default
|
||||
for historical reasons.
|
||||
|
||||
** Support for non-blocking I/O
|
||||
|
||||
See "Non-Blocking I/O" in the manual, for more.
|
||||
|
||||
** Removal of port locks
|
||||
|
||||
As part of the 2.2 series, we introduced recursive locks on each port,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue