Slicer: 2145-support-for-installing-extension-from-file 9f0833be

Author Committer Branch Timestamp Parent
jcfr jcfr 2145-support-for-installing-extension-from-file 2014-01-05 21:16:04 2145-support-for-installing-extension-from-file 3200d4f2
Affected Issues 0003395: when quitting Slicer, cli process continue
Changeset

ENH: Kill CLI executable process on Slicer exit.

The use of a MutexLock is required because the process have been
initiated from a thread and they are killed by calling "itksysProcess_Kill()"
from the main thread.

In "ApplyTask()", the MutexLock is Locked/Unlocked at the position:

1) After calling "itksysProcess_Kill()" in "KillProcesses()", the call to
"itksysProcess_WaitForExit()" in "ApplyTask()" leads to a call
"kwsysProcessCleanup". Since calling "kwsysProcessCleanup" frees the memory
(i.e free ForkPIDs, RealWorkingDirectory and also cleanup descriptor)
and that "kwsysProcess_Kill" expects the ForkPIDs array to be available,
it is required to use a mutex to make sure the call to "kwsysProcess_Kill"
completes before "itksysProcess_WaitForExit" is executed.

2) When calling "itksysProcess_Delete()" and updating the vector of
"Processes" that is accessed from both the main thread and the ApplyTask
thread.

Fixes 0003395

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22796 3bd1e089-480b-0410-8dfb-8563597acbee

mod - Base/QTCLI/qSlicerCLIExecutableModuleFactory.cxx Diff File
mod - Base/QTCLI/qSlicerCLIExecutableModuleFactory.h Diff File
mod - Base/QTCLI/vtkSlicerCLIModuleLogic.cxx Diff File
mod - Base/QTCLI/vtkSlicerCLIModuleLogic.h Diff File