Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NF: document that withCol and withQueue executes in IO #13950

Merged
merged 2 commits into from Jun 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions AnkiDroid/src/main/java/com/ichi2/anki/CollectionManager.kt
Expand Up @@ -58,8 +58,10 @@ object CollectionManager {
var emulateOpenFailure = false

/**
* Execute the provided block on a serial queue, to ensure concurrent access
* does not happen.
* Execute the provided block on a serial background queue, to ensure
* concurrent access does not happen.
*
* The background queue is run in a [Dispatchers.IO] context.
* It's important that the block is not suspendable - if it were, it would allow
* multiple requests to be interleaved when a suspend point was hit.
*
Expand Down Expand Up @@ -88,6 +90,8 @@ object CollectionManager {
/**
* Execute the provided block with the collection, opening if necessary.
*
* Calls are serialized, and run in background [Dispatchers.IO] thread.
*
* Parallel calls to this function are guaranteed to be serialized, so you can be
* sure the collection won't be closed or modified by another thread. This guarantee
* does not hold if legacy code calls [getColUnsafe].
Expand Down