dispatch_after(3)
π dispatch_after(3) β the "do this later bestie" page π
okay so this is the manual for dispatch_after, from section 3 (library functions) of the Darwin manual. she's a libc / dispatch girlie and she is iconic β¨
πΈ NAME πΈ
dispatch_after β schedule blocks for deferred execution π
likeβ¦ run this thing, but NOT right now. later. on purpose. π
β¨ SYNOPSIS β¨
#include <dispatch/dispatch.h>
void
dispatch_after(dispatch_time_t when, dispatch_queue_t queue,
void (^block)(void));
void
dispatch_after_f(dispatch_time_t when, dispatch_queue_t queue,
void *context, void (*function)(void *));
two whole functions bestie, both yours π«Ά
π¦ DESCRIPTION π¦
so dispatch_after() submits the block to the given queue at the time specified by the when parameter. that's it, that's the whole vibe. β°
the when parameter is a value created by dispatch_time() or dispatch_walltime(). you don't just make one up, okay, you get it from those two. no cap.
if you want a more detailed description about submitting blocks to queues, go see dispatch_async(3). she's the main character of that topic, this page is just her time-delayed cousin π
β οΈ CAVEATS β οΈ
listen up bestie, this part matters π
- Specifying
DISPATCH_TIME_NOWas thewhenparameter is supported, but it is not as efficient as callingdispatch_async(). it works!! it's just lowkey doing the most for no reason π - The result of passing
DISPATCH_TIME_FOREVERas thewhenparameter is undefined. not "it waits forever", not "it never runs" β undefined. do not pass go. do not collect $200. π«
π§ FUNDAMENTALS π§
the dispatch_after() function is a wrapper around dispatch_after_f(). that's the lore. one is the cute front, the other is the machinery underneath. iykyk π
π₯ SEE ALSO π₯
go read those too, they're all part of the same friend group fr fr π
mwah π this page is from the Darwin manual, dated May 1, 2009. love that for her. stay scheduled, stay slay β¨π¦πΈ
π¦ where this page comes from
- ubuntu jammy: libdispatch-dev 0~svn197-3.3ubuntu2
- Copyright (c) 2008-2009 Apple Inc. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms