b3CreateWorld/b3DestroyWorld scan and rewrite Box3D's global world pool with no synchronization; concurrent creation crashed the host (0xC000001D). All five call sites (SoA world, retained session, pair step, torque lifetime) now go through one lock owned by ymir_box3d.c (SRWLOCK on Windows, pthread mutex elsewhere). Adds a multi-thread create/step/dispose test, which aborts the test host without the lock; drops the serial-test assembly attribute. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
12 lines
632 B
C
12 lines
632 B
C
// Process-wide lock around Box3D world creation and destruction. b3CreateWorld and b3DestroyWorld scan
|
|
// and rewrite the global world pool (b3_worlds) with no synchronization, so two threads creating worlds
|
|
// at once can claim the same slot and corrupt it. Stepping and every other call touch only the caller's
|
|
// own world and stay unlocked. A single world is still not thread-safe. One lock, defined in
|
|
// ymir_box3d.c, serves every translation unit.
|
|
#pragma once
|
|
|
|
#include <box3d/box3d.h>
|
|
#include <box3d/types.h>
|
|
|
|
b3WorldId ymir_create_world_locked(const b3WorldDef* def);
|
|
void ymir_destroy_world_locked(b3WorldId world_id);
|