Skip to content

Best way to read on main actor? #1698

Answered by groue
macdrevx asked this question in Q&A
Jan 15, 2025 · 1 comments · 17 replies
Discussion options

You must be logged in to vote

Hi again @macdrevx. I had a closer look, and I discovered that I spoke too fast.

It is not possible to guarantee that all sync database accesses from the main thread are never blocked by background jobs.

Yes it can work for the read method and its siblings, but it is not for other kinds of sync accesses from the main thread, such as starting a ValueObservation with the immediate scheduling. There is no way for the library user to guess which kinds of sync accesses from the main thread would be guaranteed, and which ones would not. If DatabasePool would dedicate a connection to the main thread in specific scenarios only, its behavior could not be described in a simple way. Users would not …

Replies: 1 comment 17 replies

Comment options

You must be logged in to vote
17 replies
@groue
Comment options

@macdrevx
Comment options

@groue
Comment options

@groue
Comment options

Answer selected by macdrevx
@groue
Comment options

@macdrevx
Comment options

@macdrevx
Comment options

@groue
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants