| ... | @@ -521,6 +521,8 @@ fn windowsApiUpdateThreadRun() void { | ... | @@ -521,6 +521,8 @@ fn windowsApiUpdateThreadRun() void { |
| 521 | /// Allows the caller to freely write to stderr until `unlockStdErr` is called. | 521 | /// Allows the caller to freely write to stderr until `unlockStdErr` is called. |
| 522 | /// | 522 | /// |
| 523 | /// During the lock, any `std.Progress` information is cleared from the terminal. | 523 | /// During the lock, any `std.Progress` information is cleared from the terminal. |
| | 524 | /// |
| | 525 | /// The lock is recursive; the same thread may hold the lock multiple times. |
| 524 | pub fn lockStdErr() void { | 526 | pub fn lockStdErr() void { |
| 525 | stderr_mutex.lock(); | 527 | stderr_mutex.lock(); |
| 526 | clearWrittenWithEscapeCodes() catch {}; | 528 | clearWrittenWithEscapeCodes() catch {}; |
| ... | @@ -1378,4 +1380,7 @@ const have_sigwinch = switch (builtin.os.tag) { | ... | @@ -1378,4 +1380,7 @@ const have_sigwinch = switch (builtin.os.tag) { |
| 1378 | else => false, | 1380 | else => false, |
| 1379 | }; | 1381 | }; |
| 1380 | | 1382 | |
| 1381 | var stderr_mutex: std.Thread.Mutex = .{}; | 1383 | /// The primary motivation for recursive mutex here is so that a panic while |
| | 1384 | /// stderr mutex is held still dumps the stack trace and other debug |
| | 1385 | /// information. |
| | 1386 | var stderr_mutex = std.Thread.Mutex.Recursive.init; |