1 /* Copyright (C) 2021-2024 Harry Godden (hgn) - All Rights Reserved
3 * primateves that you use when you need to run something from another thread
4 * back in the main loop of vg, at the start of each frame
10 static void vg_assert_thread( enum vg_thread_purpose required
);
12 typedef struct vg_async_item vg_async_item
;
19 void (*fn_runner
)( void *payload
, u32 size
);
26 vg_async_item
*start
, *end
;
28 SDL_sem
*sem_wait_for_flush
;
29 SDL_SpinLock sl_index
;
35 void vg_async_call( void (*runner
)( void *payload
, u32 size
),
36 void *payload
, u32 size
);
37 void vg_run_async_checked(void);
38 void vg_async_init(void);
40 vg_async_item
*vg_async_alloc( u32 size
);
42 * Mark the call as being filled and ready to go
44 void vg_async_dispatch( vg_async_item
*item
,
45 void (*runner
)( void *payload
, u32 size
) );
48 * Wait until the current stack of async calls is completely flushed out
50 void vg_async_stall(void);