Skip to content

Commit 6122502

Browse files
committed
Simplify IProcess exit code handling by removing synchronization logic
Removed the static mutex, condition variable, and exit code map that were used to track process exit codes with timeout-based waiting. These synchronization primitives have been replaced with stub implementations that immediately return success with a zero exit code. * AsyncProcess: Simplified process exit code management **Generated by CodeLite** Signed-off-by: Eran Ifrah <eran@codelite.org>
1 parent 375da9d commit 6122502

File tree

1 file changed

+5
-22
lines changed

1 file changed

+5
-22
lines changed

CodeLite/AsyncProcess/asyncprocess.cpp

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,6 @@ static void __FixArgs(wxArrayString& args)
224224
}
225225
}
226226

227-
namespace
228-
{
229-
std::mutex g_mutex;
230-
std::condition_variable g_cv;
231-
std::unordered_map<pid_t, int> g_exit_codes;
232-
} // namespace
233-
234227
IProcess* CreateAsyncProcess(wxEvtHandler* parent,
235228
const std::vector<wxString>& args,
236229
size_t flags,
@@ -317,25 +310,15 @@ IProcess* CreateSyncProcess(const wxString& cmd, size_t flags, const wxString& w
317310
// Static methods:
318311
bool IProcess::GetProcessExitCode(int pid, int& exitCode)
319312
{
320-
std::unique_lock lock(g_mutex);
321-
auto predicate = [&]() { return g_exit_codes.find(pid) != g_exit_codes.end(); };
322-
323-
// Wait with timeout
324-
if (g_cv.wait_for(lock, std::chrono::seconds(1), predicate)) {
325-
exitCode = g_exit_codes[pid];
326-
g_exit_codes.erase(pid);
327-
return true;
328-
}
329-
return false;
313+
wxUnusedVar(pid);
314+
exitCode = 0;
315+
return true;
330316
}
331317

332318
void IProcess::SetProcessExitCode(int pid, int exitCode)
333319
{
334-
{
335-
std::unique_lock lock(g_mutex);
336-
g_exit_codes[pid] = exitCode;
337-
}
338-
g_cv.notify_all();
320+
wxUnusedVar(pid);
321+
wxUnusedVar(exitCode);
339322
}
340323

341324
void IProcess::WaitForTerminate(wxString& output)

0 commit comments

Comments
 (0)