mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Concurrency] Replace SWIFT_TASK_PRINTF_DEBUG with a SWIFT_TASK_DEBUG_LOG macro.
This macro takes the string and parameters directly, and is conditionally defined to either call fprintf or ignore its arguments. This makes the call sites a little more pleasant (no #if scattered about) and ensures every log includes the thread ID and a newline automatically.
This commit is contained in:
@@ -31,18 +31,14 @@ TSanFunc *tsan_acquire, *tsan_release;
|
||||
void swift::_swift_tsan_acquire(void *addr) {
|
||||
if (tsan_acquire) {
|
||||
tsan_acquire(addr);
|
||||
#if SWIFT_TASK_PRINTF_DEBUG
|
||||
fprintf(stderr, "[%lu] tsan_acquire on %p\n", _swift_get_thread_id(), addr);
|
||||
#endif
|
||||
SWIFT_TASK_DEBUG_LOG("tsan_acquire on %p", addr);
|
||||
}
|
||||
}
|
||||
|
||||
void swift::_swift_tsan_release(void *addr) {
|
||||
if (tsan_release) {
|
||||
tsan_release(addr);
|
||||
#if SWIFT_TASK_PRINTF_DEBUG
|
||||
fprintf(stderr, "[%lu] tsan_release on %p\n", _swift_get_thread_id(), addr);
|
||||
#endif
|
||||
SWIFT_TASK_DEBUG_LOG("tsan_release on %p", addr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user