Skip to content

Commit bb09297

Browse files
committed
[Concurrency] Fix getTaskId.
We should build a 64-bit value from the two 32-bit Id fields, but we were shifting one field by the other. Coincidentally, this managed to produce the correct value until the ID goes beyond 2^32, but after that it's weird and wrong.
1 parent 97186b0 commit bb09297

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

stdlib/public/Concurrency/Task.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ void AsyncTask::setTaskId() {
347347
uint64_t AsyncTask::getTaskId() {
348348
// Reconstitute a full 64-bit task ID from the 32-bit job ID and the upper
349349
// 32 bits held in _private().
350-
return (uint64_t)Id << _private().Id;
350+
return ((uint64_t)_private().Id << 32) | (uint64_t)Id;
351351
}
352352

353353
SWIFT_CC(swift)

0 commit comments

Comments
 (0)