be a bit more robust to failures in window creation, IPC thread launching, & semaphore non-implemented parts

This commit is contained in:
Ryan Fleury
2025-05-10 14:39:32 -07:00
parent 3fd1f9d255
commit 868f2d0660
3 changed files with 10 additions and 3 deletions
+1 -1
View File
@@ -1071,7 +1071,7 @@ os_semaphore_alloc(U32 initial_count, U32 max_count, String8 name)
OS_Handle result = {0};
if (name.size > 0) {
// TODO: we need to allocate shared memory to store sem_t
NotImplemented;
// NotImplemented;
} else {
sem_t *s = mmap(0, sizeof(*s), PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
AssertAlways(s != MAP_FAILED);
+4
View File
@@ -12900,6 +12900,10 @@ rd_frame(void)
Vec2F32 monitor_dim = os_dim_from_monitor(monitor);
F32 monitor_dpi = os_dpi_from_monitor(monitor);
Vec2F32 window_dim = v2f32(monitor_dim.x*4/5, monitor_dim.y*4/5);
if(window_dim.x == 0 || window_dim.y == 0)
{
window_dim = v2f32(1280, 720);
}
RD_Cfg *new_window = rd_cfg_new(file_root, str8_lit("window"));
RD_Cfg *size = rd_cfg_new(new_window, str8_lit("size"));
rd_cfg_newf(size, "%f", window_dim.x);
+5 -2
View File
@@ -528,8 +528,11 @@ entry_point(CmdLine *cmd_line)
ipc_s2m_ring_mutex = os_mutex_alloc();
ipc_s2m_ring_cv = os_condition_variable_alloc();
IPCInfo *ipc_info = (IPCInfo *)ipc_shared_memory_base;
MemoryZeroStruct(ipc_info);
os_thread_launch(ipc_signaler_thread__entry_point, 0, 0);
if(ipc_shared_memory_base != 0)
{
MemoryZeroStruct(ipc_info);
os_thread_launch(ipc_signaler_thread__entry_point, 0, 0);
}
scratch_end(scratch);
}