/* date = April 29th 2023 9:18 pm */

#ifndef BASE_THREAD_CONTEXT_H
#define BASE_THREAD_CONTEXT_H

typedef struct ThreadContext ThreadContext;
struct ThreadContext 
{
    Arena *arenas[2]; // WHy 2 arenas?
    char *file_name;
    U64 line_number;
    U8 thread_name[32];
    U64 thread_name_size;
    B32 is_main_thread;
};

//root_function ThreadContext make_thread_context(void);

root_function ThreadContext thread_context_alloc(void);
root_function void thread_context_release(ThreadContext *context);

no_name_mangle void
thread_context_set(ThreadContext *context);
no_name_mangle ThreadContext *
thread_context_gett(void);


root_function B32 is_main_thread(void);

//~ scratch memory
root_function ArenaTemp scratch_get(Arena **conflicts, U64 conflict_count);
#define scratch_release(temp) m_arena_temp_end(temp)

//~ entry
// Takes a function pointer to the app entry function.
root_function void 
base_main_thread_entry(void (*entry)(void), U64 argument_count, char **arguments);

#endif //BASE_THREAD_CONTEXT_H
