# Actors, Threading and SQLite

**URL:** <https://forums.swift.org/t/actors-threading-and-sqlite/49710>\
**Category:** Discussion\
**Tags:** concurrency, asyncawait, actors\
**Created:** [June 17, 2021, 3:00pm UTC](https://forums.swift.org/t/actors-threading-and-sqlite/49710 "2021-06-17T15:00:38Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![ktoso](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ktoso/32/44526_2.png) [@ktoso](https://forums.swift.org/u/ktoso)\
**Post date:** [June 17, 2021, 3:12pm UTC](https://forums.swift.org/t/actors-threading-and-sqlite/49710/2 "2021-06-17T15:12:47Z")

</div>

> that **no** single database **connection is used simultaneously in two or more threads**.

This will work fine with the existing actor model, as long as a connection is not shared by any two (or more actors). As long as at most one actor has the `connection` it will be properly accessed by at most one thread - the one the actor is running on. The connection type should therefore _not_ be Sendable.

One could also make it work well in the single threaded, no mutexes at all mode I believe... If it really strictly needed "only one specific thread" and not just mutual exclusion, we could make this work once we get the custom executors which have an early pitch here: [Support custom executors in Swift concurrency](https://forums.swift.org/t/support-custom-executors-in-swift-concurrency/44425)

but indeed, for now the multi threaded mode should be compatible with actors IMHO.

---

_[View the full topic](https://forums.swift.org/t/actors-threading-and-sqlite/49710)._
