Skip to content

Commit 4eb26ae

Browse files
committed
[Concurrency] Fix two cases where tasks were signposted with %p.
Task pointers are not very useful for sigpost consumers. Send them task IDs instead, which are unique during a run. We mostly do this, but missed two places where we were still sending pointers.
1 parent 5f3489d commit 4eb26ae

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

stdlib/public/Concurrency/TracingSignpost.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,13 @@ inline void task_create(AsyncTask *task, AsyncTask *parent, TaskGroup *group,
173173
AsyncLet *asyncLet) {
174174
ENSURE_LOGS();
175175
auto id = os_signpost_id_make_with_pointer(TaskLog, task);
176+
auto parentID = parent ? parent->getTaskId() : 0;
176177
os_signpost_interval_begin(
177178
TaskLog, id, SWIFT_LOG_TASK_LIFETIME_NAME,
178179
"task=%" PRIx64 " resumefn=%p flags=0x%" PRIx32
179-
" parent=%p group=%p asyncLet=%p",
180+
" parent=%" PRIx64 " group=%p asyncLet=%p",
180181
task->getTaskId(), task->getResumeFunctionForLogging(),
181-
task->Flags.getOpaqueValue(), parent, group, asyncLet);
182+
task->Flags.getOpaqueValue(), parentID, group, asyncLet);
182183
}
183184

184185
inline void task_destroy(AsyncTask *task) {
@@ -208,9 +209,10 @@ inline void task_flags_changed(AsyncTask *task, uint32_t flags) {
208209
inline void task_wait(AsyncTask *task, AsyncTask *waitingOn, uintptr_t status) {
209210
ENSURE_LOGS();
210211
auto id = os_signpost_id_make_with_pointer(TaskLog, task);
212+
auto waitingID = waitingOn ? waitingOn->getTaskId() : 0;
211213
os_signpost_event_emit(TaskLog, id, SWIFT_LOG_TASK_WAIT_NAME,
212-
"task=%" PRIx64 " waitingOnTask=%p status=0x%" PRIxPTR,
213-
task->getTaskId(), waitingOn, status);
214+
"task=%" PRIx64 " waitingOnTask=%" PRIx64 " status=0x%" PRIxPTR,
215+
task->getTaskId(), waitingID, status);
214216
}
215217

216218
inline void job_enqueue_global(Job *job) {

0 commit comments

Comments
 (0)