+ implemented SysUtils.Sleep for WASI

This commit is contained in:
Nikolay Nikolov 2021-10-06 05:39:11 +03:00
parent d134fc1ddf
commit 7533496505

View File

@ -281,7 +281,18 @@ end;
*************************************************************************}
procedure Sleep (MilliSeconds: Cardinal);
var
subscription: __wasi_subscription_t;
event: __wasi_event_t;
nevents: __wasi_size_t;
begin
FillChar(subscription,SizeOf(subscription),0);
subscription.u.tag:=__WASI_EVENTTYPE_CLOCK;
subscription.u.u.clock.id:=__WASI_CLOCKID_MONOTONIC;
subscription.u.u.clock.timeout:=MilliSeconds*1000000;
subscription.u.u.clock.precision:=1000000;
subscription.u.u.clock.flags:=0; { timeout value is relative }
__wasi_poll_oneoff(@subscription,@event,1,@nevents);
end;
{****************************************************************************