renamed hawk_rtx_cleario() to hawk_rtx_clearallios().

added hawk_rtx_flushallios().
revised hawk_rtx_loop() and hawk_rtx_callfun() to call hawk_rtx_flushallios() instead of hawk_rtx_clearallios().
changed the io handler to discard unflushed data if flushing fails in std.c
This commit is contained in:
2020-04-08 10:23:31 +00:00
parent a23eeee168
commit d9ffad1227
5 changed files with 72 additions and 40 deletions

View File

@@ -1158,7 +1158,7 @@ static void fini_rtx (hawk_rtx_t* rtx, int fini_globals)
/* close all pending io's */
/* TODO: what if this operation fails? */
hawk_rtx_cleario (rtx);
hawk_rtx_clearallios (rtx);
HAWK_ASSERT (rtx->rio.chain == HAWK_NULL);
if (rtx->gbl.rs[0])
@@ -1672,8 +1672,8 @@ hawk_val_t* hawk_rtx_loop (hawk_rtx_t* rtx)
/* reset the exit level */
rtx->exit_level = EXIT_NONE;
/* clear any pending io's */
hawk_rtx_cleario (rtx);
/* flush all buffered io data */
hawk_rtx_flushallios (rtx);
return retv;
}
@@ -1829,8 +1829,8 @@ hawk_val_t* hawk_rtx_callfun (hawk_rtx_t* rtx, hawk_fun_t* fun, hawk_val_t* args
hawk_rtx_refupval (rtx, v);
}
/* clear any pending io's */
hawk_rtx_cleario (rtx);
/* flush all buffered io data */
hawk_rtx_flushallios (rtx);
/* return the return value with its reference count at least 1.
* the caller of this function should count down its reference. */