mirror of
https://github.com/Ed94/metadesk.git
synced 2026-06-12 23:51:37 -07:00
45 lines
1.2 KiB
C
45 lines
1.2 KiB
C
#ifdef INTELLISENSE_DIRECTIVES
|
|
# pragma once
|
|
# include "linkage.h"
|
|
# include "base_types.h"
|
|
# include "strings.h"
|
|
# include "arena.h"
|
|
#endif
|
|
|
|
// Copyright (c) 2024 Epic Games Tools
|
|
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
|
|
|
////////////////////////////////
|
|
// NOTE(allen): Thread Context
|
|
|
|
typedef struct TCTX TCTX;
|
|
struct TCTX
|
|
{
|
|
Arena* arenas[2];
|
|
|
|
U8 thread_name[32];
|
|
U64 thread_name_size;
|
|
|
|
char* file_name;
|
|
U64 line_number;
|
|
};
|
|
|
|
////////////////////////////////
|
|
// NOTE(allen): Thread Context Functions
|
|
|
|
internal void tctx_init_and_equip(TCTX *tctx);
|
|
internal void tctx_release(void);
|
|
internal TCTX* tctx_get_equipped(void);
|
|
|
|
internal Arena* tctx_get_scratch(Arena** conflicts, U64 count);
|
|
|
|
internal void tctx_set_thread_name(String8 name);
|
|
internal String8 tctx_get_thread_name(void);
|
|
|
|
internal void tctx_write_srcloc(char* file_name, U64 line_number);
|
|
internal void tctx_read_srcloc (char** file_name, U64* line_number);
|
|
#define tctx_write_this_srcloc() tctx_write_srcloc(__FILE__, __LINE__)
|
|
|
|
#define scratch_begin(conflicts, count) temp_begin(tctx_get_scratch((conflicts), (count)))
|
|
#define scratch_end(scratch) temp_end(scratch)
|