zig-tracy icon indicating copy to clipboard operation
zig-tracy copied to clipboard

Add tracing mutex support

Open basdp opened this issue 1 month ago • 0 comments

As announced in #10, here is my implementation of lockables in the form of mutexes. I decided it would be nicest to wrap the Tracy API in a TracingMutex struct (much like TracingAllocator). This mimicks the intended use of lockables in Tracy for C++ in an idiomatic Zig way.

  • Implement TracingMutex, wiring Tracy lockable contexts for lock/tryLock/unlock with source metadata.
  • Announce and customize lockables, emit lock/unlock markers, and ensure proper cleanup.
  • Added a helper function getSrcLoc(..) to re-use source location trick and clean up the flow of code.
  • Refactored examples into an examples/ folder for nicer organization of multiple examples (decided to split the mutex example to not clutter the basic example).
  • Update example to build cleanly on Windows with console control handling.

Closes #10.

Schermafbeelding 2025-11-26 104913

basdp avatar Nov 26 '25 12:11 basdp