Skip to content

Commit 28493d0

Browse files
authored
Merge pull request #62716 from apple/eng/PR-103426321-mutex-initialization
[Task-to-Thread] Make sure to explicitly initialize the drainLock in DefaultActorImpl::initialize
2 parents 42ede18 + 1ba0462 commit 28493d0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

stdlib/public/Concurrency/Actor.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,9 @@ class DefaultActorImpl : public HeapObject {
853853
/// Properly construct an actor, except for the heap header.
854854
void initialize(bool isDistributedRemote = false) {
855855
this->isDistributedRemoteActor = isDistributedRemote;
856-
#if !SWIFT_CONCURRENCY_ACTORS_AS_LOCKS
856+
#if SWIFT_CONCURRENCY_ACTORS_AS_LOCKS
857+
new (&this->drainLock) Mutex();
858+
#else
857859
_status().store(ActiveActorStatus(), std::memory_order_relaxed);
858860
#endif
859861
SWIFT_TASK_DEBUG_LOG("Creating default actor %p", this);

0 commit comments

Comments
 (0)