darling-libdispatch/man/dispatch_after.3
2022-03-26 14:21:45 -07:00

69 lines
1.6 KiB
Groff

.\" Copyright (c) 2008-2010 Apple Inc. All rights reserved.
.Dd May 1, 2009
.Dt dispatch_after 3
.Os Darwin
.Sh NAME
.Nm dispatch_after
.Nd schedule blocks for deferred execution
.Sh SYNOPSIS
.Fd #include <dispatch/dispatch.h>
.Ft void
.Fo dispatch_after
.Fa "dispatch_time_t when" "dispatch_queue_t queue" "void (^block)(void)"
.Fc
.Ft void
.Fo dispatch_after_f
.Fa "dispatch_time_t when" "dispatch_queue_t queue" "void *context" "void (*function)(void *)"
.Fc
.Sh DESCRIPTION
The
.Fn dispatch_after
function submits the
.Fa block
to the given
.Fa queue
at the time specified by the
.Fa when
parameter.
The
.Fa when
parameter is a value created by
.Fn dispatch_time
or
.Fn dispatch_walltime .
Submission of the block may be delayed by the system in order to improve power consumption and system performance.
The system applies a leeway (see
.Xr dispatch_source_set_timer 3 )
that is equal to one tenth of the interval between
.Fa when
and the time at which the function is called, with the leeway capped to at least one millisecond and at most one minute.
.Pp
For a more detailed description about submitting blocks to queues, see
.Xr dispatch_async 3 .
.Sh FUNDAMENTALS
The
.Fn dispatch_after
function is a wrapper around
.Fn dispatch_after_f .
.Sh SEE ALSO
.Xr dispatch 3 ,
.Xr dispatch_async 3 ,
.Xr dispatch_time 3
.Sh CAVEATS
.Fn dispatch_after
retains the passed queue.
.Pp
Specifying
.Vt DISPATCH_TIME_NOW
as the
.Fa when
parameter
is supported, but is not as efficient as calling
.Fn dispatch_async .
.Pp
The result of passing
.Vt DISPATCH_TIME_FOREVER
as the
.Fa when
parameter is undefined.