mirror of
https://github.com/ankidroid/Anki-Android.git
synced 2024-09-20 03:52:15 +02:00
NF: document that withCol
and withQueue
executes in IO (#13950)
* NF: document that `withCol` and `withQueue` executes in IO I had some doubt about which function moves to IO dispatcher, whether it was launch method or withCol. I expect this documentation may save a minute to other devs too. * Update AnkiDroid/src/main/java/com/ichi2/anki/CollectionManager.kt --------- Co-authored-by: Brayan Oliveira <69634269+BrayanDSO@users.noreply.github.com>
This commit is contained in:
parent
afcaf4520b
commit
fcb4e251fe
@ -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.
|
||||
*
|
||||
@ -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].
|
||||
|
Loading…
Reference in New Issue
Block a user