-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add an additional case for clocks to sleep with a wallclock deadline #79139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
case swift_clock_id_wall: | ||
struct timespec wall; | ||
#if defined(__linux__) || defined(__APPLE__) || defined(__wasi__) || defined(__OpenBSD__) || defined(__FreeBSD__) | ||
clock_gettime(CLOCK_REALTIME, &wall); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
timespec_get(&wall, TIME_UTC)
is the C standard API for this and is supported on Windows too.
case swift_clock_id_wall: { | ||
struct timespec wall; | ||
#if defined(__linux__) || defined(__APPLE__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__wasi__) | ||
clock_getres(CLOCK_REALTIME, &wall); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above, timespec_getres(&wall, TIME_UTC)
is standard and works on Windows too.
1448d25
to
1c75060
Compare
This only modifies the runtime function
swift_task_enqueueGlobalWithDeadline
to take new clock primitive to interoperate with dispatch's wall clock values.