mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 06:50:54 +07:00
[RIDER] Expand documentation for cancelCurrentInputEventProcessingAndRun method
GitOrigin-RevId: a6572cf2d1fc56b01fbe9765f241ca3364fa9d8e
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3c5a960ecd
commit
60ab8bb505
@@ -981,7 +981,18 @@ object Utils {
|
||||
private val cancellationDispatcher = Dispatchers.IO.limitedParallelism(1)
|
||||
private var ourCurrentInputEventProcessingJobFlow = MutableStateFlow<Job?>(null)
|
||||
|
||||
// DO NOT USE. RIDER ONLY!
|
||||
/**
|
||||
* DO NOT USE. RIDER ONLY!
|
||||
* Cancels the current input event processing and runs the provided block.
|
||||
*
|
||||
* This method ensures that any ongoing input event processing is canceled before running the block.
|
||||
* Using to prevent deadlock when EDT is blocked by runWithInputEventEdtDispatcher and important sync call from
|
||||
* the backend main thread is requiring to run something on the EDT
|
||||
*
|
||||
* @param block The suspending function to execute after cancelling the current input event processing.
|
||||
* @return The result of the provided block function.
|
||||
*/
|
||||
@DelicateCoroutinesApi
|
||||
suspend fun <T> cancelCurrentInputEventProcessingAndRun(block: suspend () -> T): T = coroutineScope {
|
||||
val cancelJob = launch(cancellationDispatcher) {
|
||||
ourCurrentInputEventProcessingJobFlow.collectLatest {
|
||||
|
||||
Reference in New Issue
Block a user