# Support custom executors in Swift concurrency

**URL:** <https://forums.swift.org/t/support-custom-executors-in-swift-concurrency/44425>\
**Category:** Pitches\
**Created:** [February 4, 2021, 12:42am UTC](https://forums.swift.org/t/support-custom-executors-in-swift-concurrency/44425 "2021-02-04T00:42:05Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![jayton](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jayton/32/5592_2.png) [@jayton](https://forums.swift.org/u/jayton)\
**Post date:** [February 4, 2021, 10:38am UTC](https://forums.swift.org/t/support-custom-executors-in-swift-concurrency/44425/11 "2021-02-04T10:38:45Z")

</div>

Nit (Motivation section):

> and instead needs only on high-level semantic properties

“needs only high-level…” or “relies only on high-level…”, I assume

`UnownedJobRef`:

> The executor reference must remain valid during this call unless it is a serial executor which the job successfully gives up.

This is unclear to me. Does it mean that if `execute(currentExecutor: someRef)` in turn causes some switching or suspending activity, `someRef` can then become invalid before this invocation of `execute` returns?

Also, would it not make sense to have a version of `Task.runDetached` that takes an executor? Or should we assume that `Task.runDetached { someExecutor.run { … }}` will avoid bouncing off the default concurrent scheduler?

---

_[View the full topic](https://forums.swift.org/t/support-custom-executors-in-swift-concurrency/44425)._
