
Concurrency: - Refactored spinlock out of OS api (deprecated old procs) - Concurrency utilites: void spinlock_init(Spinlock *l); void spinlock_acquire_or_wait(Spinlock* l); bool spinlock_acquire_or_wait_timeout(Spinlock* l, f64 timeout_seconds); void spinlock_release(Spinlock* l); void mutex_init(Mutex *m); void mutex_destroy(Mutex *m); void mutex_acquire_or_wait(Mutex *m); void mutex_release(Mutex *m); void binary_semaphore_init(Binary_Semaphore *sem, bool initial_state); void binary_semaphore_destroy(Binary_Semaphore *sem); void binary_semaphore_wait(Binary_Semaphore *sem); void binary_semaphore_signal(Binary_Semaphore *sem); Macro MEMORY_BARRIER - Concurrency tests Docs: - custom_logger.c example to show how one can make a custom logger and have logs displayed in-game Utility: - draw_text_and_measure() which is just an overload of draw_text but it also does a measure and returns it Misc: - Added u64 thread_id to global context. This is set in main() for main thread and in thread startup when you dispatch a Thread - Fixed a bug where plain rects would be drawn with the incorrect color - Fixed a bug where quads from earlier frames would be drawn
27 lines
No EOL
475 B
C
27 lines
No EOL
475 B
C
|
|
|
|
|
|
typedef struct Bucket_Array {
|
|
|
|
|
|
|
|
u64 _block_size;
|
|
u64 _bucket_count;
|
|
} Bucket_Array;
|
|
|
|
typedef struct Bucket_Array_Free_Node {
|
|
struct Bucket_Array_Free_Node *next;
|
|
} Bucket_Array_Free_Node;
|
|
typedef struct Bucket_Array_Bucket {
|
|
Bucket_Array_Free_Node *first_free;
|
|
void *data;
|
|
Bucket *next;
|
|
} Bucket_Array_Bucket;
|
|
|
|
|
|
Bucket_Array make_bucket_array(u64 block_size, u64 bucket_count) {
|
|
Bucket_Array ba;
|
|
|
|
ba._block_size = block_size;
|
|
ba._bucket_count = bucket_count;
|
|
} |