swift
8d24648c - [6.0][Concurrency] Retain the actor around the CAS in enqueue() when necessary.

Commit
349 days ago
[6.0][Concurrency] Retain the actor around the CAS in enqueue() when necessary. It's possible that the job we enqueue holds the last strong reference to the actor. If that job runs on another thread after we enqueue it, then it's possible for `this` to be destroyed while we're still in this function. We need to use `this` after the enqueue when the priorities don't match. When it looks like that will happen, retain `this` before the enqueue to ensure it stays alive until we're done with it. Introduce a defensive retain helper class that makes it easy to do a single retain under certain conditions even in a loop, and does RAII to balance it with a release when the scope exits. rdar://135400933 (cherry picked from commit 6b01fed9c4117e4eda07cc7bbaa92695da9da464)
Author
Committer
Parents
Loading