Skip to content

Conversation

@ktoso
Copy link
Member

@ktoso ktoso commented Jun 6, 2022

No description provided.

@ktoso ktoso force-pushed the wip-cleanups branch 2 times, most recently from 68436ee to ee8093f Compare June 8, 2022 07:20
@ktoso ktoso enabled auto-merge (rebase) June 8, 2022 12:05
@ktoso ktoso disabled auto-merge June 8, 2022 12:05
@ktoso ktoso merged commit 9b74386 into apple:main Jun 8, 2022
@ktoso ktoso deleted the wip-cleanups branch June 8, 2022 12:06
let system = self.actorSystem
system?.shutdownLock.lock()
defer {
system?.shutdownLock.unlock()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ktoso this isn't legal code because you may lock and unlock on different threads which is UB and will likely crash. So you can never hold a mutex/lock across an await. I'd recommend only using the withLock { ... } version which will prevent you from doing this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh boy, you're right of course -- moving to DispatchSemaphore. Thanks for spotting this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants