05nelsonm / kmp-process

Process implementation for Kotlin Multiplatform
Apache License 2.0
30 stars 1 forks source link

`NativeProcess.destroy` should check `isDestroyed` when closing threads #71

Closed 05nelsonm closed 7 months ago

05nelsonm commented 7 months ago

Current setup is that NativeProcess.destroy is creating a local variable hasBeenClosed and checking if the StdioHandle has been closed yet. This is not ideal.

When destroy is called, the lock should be obtained and, within the lock, a local variable created hasBeenDestroyed before setting isDestroyed to true. Then if hasBeenDestroyed is false, Workers should be destroyed. This is so that the Workers are destroyed once and only once.