# SE-0417: Task Executor Preference

**URL:** <https://forums.swift.org/t/se-0417-task-executor-preference/68958>\
**Category:** Proposal Reviews\
**Created:** [December 13, 2023, 12:35am UTC](https://forums.swift.org/t/se-0417-task-executor-preference/68958 "2023-12-13T00:35:54Z")\
**Posts on this page:** 1\
**Showing post:** 27

<div class="post-metadata">

**Author:** ![mklbtz](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/mklbtz/32/21972_2.png) [@mklbtz](https://forums.swift.org/u/mklbtz)\
**Post date:** [December 18, 2023, 2:43pm UTC](https://forums.swift.org/t/se-0417-task-executor-preference/68958/27 "2023-12-18T14:43:28Z")

</div>

One of the first thoughts I had was "Oh, could this replace PointFree's replace-the-global-enqueue-hook hack for more deterministic testing?"

```swift
// Naively run all test tasks on the main thread…
await withMainExecutor {
    await testMyCode()
}

```

Testing wasn't mentioned in the proposal, but I'm sure I won't be the only one to think of this.  
Also, with the exceptions mentioned in the proposal, it seems like it might not work completely?

I guess I'm wondering if you think this is a viable solution to [this topic from last year](https://forums.swift.org/t/reliably-testing-code-that-adopts-swift-concurrency/57304) since the approach seems somewhat similar.

---

_[View the full topic](https://forums.swift.org/t/se-0417-task-executor-preference/68958)._
