Modified the Lua API timeout argument specification to be an extension of the v3.9 specification

Fix the v3.9-incompatible changes in 8e02cde ("Lua API Timeout
Specification Changes to Enable Non-Blocking Reads", November 15, 2025)
to make them compatible.

The timeout arguments for tio.expect/s(), tio.read(), and tio.readline()
have been changed as follows:
- The timeout is in milliseconds, and the default is 0, which means to
wait forever (as in v3.9).
- A negative value means to nowait.

A constant table (tio.C) has also been added,
defining tio.C.FOREVER to 0 and tio.C.NOWAIT to -1.
This commit is contained in:
yabu76 2026-02-01 11:56:29 +09:00
parent 0da8731c0b
commit c009ed755c
3 changed files with 33 additions and 11 deletions

View file

@ -302,7 +302,7 @@ void tty_sync(int fd)
while (remain > 0)
{
count = write_poll(fd, cp, remain, WRITE_POLL_FOREVER);
count = write_poll(fd, cp, remain, POLL_FOREVER);
if (count < 0)
{
// Error
@ -360,7 +360,7 @@ static ssize_t tty_raw_write(int fd)
continue;
}
retval = write_poll(fd, &tty_buffer[i], 1, WRITE_POLL_FOREVER);
retval = write_poll(fd, &tty_buffer[i], 1, POLL_FOREVER);
if (retval < 0)
{
// Error