Skip to content

Instantly share code, notes, and snippets.

View nil-ableton's full-sized avatar

Nicolas Léveillé nil-ableton

View GitHub Profile
typedef int task_t; // Lower bits as table index, upper bits as generation counter for use-after-free detection.
typedef void (*task_function_t)(void *task_data);
task_t task_create(task_function_t task_function, void *task_data);
void task_depends(task_t task, task_t dependency);
void task_start(task_t task);
Upon completion, tasks signal their dependencies and are released.
Memory requirements for a minimal implementation: 16/24 bytes per task and 8 bytes per dependency edge.
Even so, you still don't want to have one task instance for every array entry in a gigabyte array. Always assign
@mmozeiko
mmozeiko / ctime.c
Last active May 7, 2024 15:35
ctime.c
/* ========================================================================
$File: tools/ctime/ctime.c $
$Date: 2016/05/08 04:16:55PM $
$Revision: 7 $
$Creator: Casey Muratori $
$Notice:
The author of this software MAKES NO WARRANTY as to the RELIABILITY,
SUITABILITY, or USABILITY of this software. USE IT AT YOUR OWN RISK.
/* ========================================================================
$File: tools/ctime/ctime.c $
$Date: 2016/05/08 04:16:55PM $
$Revision: 7 $
$Creator: Casey Muratori $
$Notice:
The author of this software MAKES NO WARRANTY as to the RELIABILITY,
SUITABILITY, or USABILITY of this software. USE IT AT YOUR OWN RISK.