diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-12-26 14:02:07 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-12-26 17:33:15 -0700 |
| commit | cb290ed6c99681ade0bace286ae5040546542395 (patch) | |
| tree | d1ab691a60dc111ae9d5feb057c731fad593d812 | |
| parent | 3366e4caf3ab3f85cfac9b57b84db4eb9ee0a078 (diff) | |
| download | zig-cb290ed6c99681ade0bace286ae5040546542395.tar.gz zig-cb290ed6c99681ade0bace286ae5040546542395.zip | |
stage2: Cache deadlock debugging only for safe build modes
| -rw-r--r-- | src/Cache.zig | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/Cache.zig b/src/Cache.zig index 9f32f15a01..7d77782a6f 100644 --- a/src/Cache.zig +++ b/src/Cache.zig @@ -13,11 +13,10 @@ const fmt = std.fmt; const Allocator = std.mem.Allocator; /// Process-scoped map keeping track of all locked Cache hashes, to detect deadlocks. -/// The plan is to enable this for debug builds only, but for now we enable -/// it always to catch a deadlock. +/// This protection is conditionally compiled depending on `want_debug_deadlock`. var all_cache_digest_set: std.AutoHashMapUnmanaged(BinDigest, void) = .{}; var all_cache_digest_lock: std.Mutex = .{}; -const want_debug_deadlock = true; // TODO change this for release builds +const want_debug_deadlock = std.debug.runtime_safety; const DebugBinDigest = if (want_debug_deadlock) BinDigest else void; const null_debug_bin_digest = if (want_debug_deadlock) ([1]u8{0} ** bin_digest_len) else {}; |
