Close process on check success
The interruptible version of the function to check process success (sc_process_check_success_intr()) did not accept a close parameter to avoid a race condition. But as the result, the processes were not closed at all. Add a close parameter, and close the process separately to avoid the race condition.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
bool
|
||||
sc_process_check_success_intr(struct sc_intr *intr, sc_pid pid,
|
||||
const char *name) {
|
||||
const char *name, bool close) {
|
||||
if (!sc_intr_set_process(intr, pid)) {
|
||||
// Already interrupted
|
||||
return false;
|
||||
@@ -12,5 +12,11 @@ sc_process_check_success_intr(struct sc_intr *intr, sc_pid pid,
|
||||
bool ret = sc_process_check_success(pid, name, false);
|
||||
|
||||
sc_intr_set_process(intr, SC_PROCESS_NONE);
|
||||
|
||||
if (close) {
|
||||
// Close separately
|
||||
sc_process_close(pid);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,6 @@
|
||||
|
||||
bool
|
||||
sc_process_check_success_intr(struct sc_intr *intr, sc_pid pid,
|
||||
const char *name);
|
||||
const char *name, bool close);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user