OrangeC
OrangeC copied to clipboard
FR: implement nanosleep
nanosleep, defined in time.h seems to actually be referenced in some sources in the repository, but isn't implemented yet.
This issue has no priority for me at all, but it may be relative easy to implement.
Note (to quote the manpage):
The
nanosleep()function shall return a value of0on success and-1on failure or if interrupted. This latter case is different fromsleep(). This was done because the remaining time is returned via an argument structure pointer,rmtp, instead of as the return value.
As nanosleep is mostly (?) referenced in libcxx tests I think it would be reasonable to move this to the 3.5 milestone.
Note: Because of the expected return code for the interrupt and because we should not claim higher precision than milliseconds if we don't provide it I think the "quick addition" of adding a new new RTS function, adjusting the argument as necessary and call existing rts functions for sleeping in milliseconds should not be used.
Just checked again: time.h defines _nanosleep - but neither that nor the non-underscore version is part of the runtime library.
I've been adding library funcitons today, this is on the list of things to yet do...