Hong Phuc
03/09/2025, 8:02 PMDispatcher.Default from <http://Dispatcher.IO|Dispatcher.IO> to handle a ProcessBuilder and got this recommendation from the intellij idea: Possibly blocking call in non-blocking context could lead to thread starvation . I used waitFor on the ProcessBuilder so it's probably why the idea suggested to switch back to <http://Dispatcher.IO|Dispatcher.IO> , does the idea suggest this for every operation that gonna block the thread its run on without knowing whether the operation depend on CPU or IO more?rkechols
03/09/2025, 8:35 PMProcessBuilder creates a new external process that doesn't use your current process's resources. Your current thread should use IO dispatcher to wait for the external process because the current thread is not computing anything; the current thread is only waiting.
It is very much the same situation as if your external process were replaced by a remote server that you access via the internet. Your current thread is waiting for input/output from something external, so it should use IO dispatcher. It doesn't matter if the external process/server is doing its own CPU work.gildor
03/10/2025, 2:15 AMgildor
03/10/2025, 2:16 AMHong Phuc
03/10/2025, 3:54 AMHong Phuc
03/10/2025, 3:56 AMwaitFor return an InterruptedException in the case that I don't use runInterruptible ?gildor
03/10/2025, 4:58 AMHong Phuc
03/10/2025, 7:27 AMwaitFor and not get GC-ed?gildor
03/10/2025, 7:28 AM