58 lines
1.2 KiB
C
58 lines
1.2 KiB
C
#pragma once
|
|
|
|
// clang-format off
|
|
#include <windows.h>
|
|
#include <windowsx.h>
|
|
#pragma comment(lib, "user32")
|
|
#pragma comment(lib, "shell32")
|
|
// clang-format on
|
|
|
|
// =============================================================================
|
|
// Entity Types
|
|
|
|
typedef enum W32_EntityKind
|
|
{
|
|
W32_EntityKind_Null,
|
|
W32_EntityKind_RWMutex,
|
|
} W32_EntityKind;
|
|
|
|
typedef struct W32_Entity W32_Entity;
|
|
struct W32_Entity
|
|
{
|
|
W32_Entity* next;
|
|
W32_EntityKind kind;
|
|
union
|
|
{
|
|
SRWLOCK rw_mutex;
|
|
};
|
|
};
|
|
|
|
// =============================================================================
|
|
// W32 state types
|
|
|
|
typedef struct W32_State W32_State;
|
|
struct W32_State
|
|
{
|
|
Arena* arena;
|
|
|
|
// info
|
|
SystemInfo system_info;
|
|
uint64 microsecond_resolution;
|
|
|
|
// entities
|
|
CRITICAL_SECTION entity_mutex;
|
|
Arena* entity_arena;
|
|
W32_Entity* entity_free;
|
|
};
|
|
|
|
// =============================================================================
|
|
// W32 globals
|
|
|
|
global W32_State w32_state = { 0 };
|
|
|
|
// =============================================================================
|
|
// Entity Functions
|
|
|
|
internal W32_Entity* w32_entity_alloc(W32_EntityKind kind);
|
|
internal void w32_entity_release(W32_Entity* entity);
|