mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-13 18:45:10 +01:00
Merge branch 'develop' of https://github.com/pocoproject/poco into develop
This commit is contained in:
commit
b2d72dcacb
@ -121,6 +121,11 @@ public:
|
||||
void start()
|
||||
/// Starts the activity by acquiring a
|
||||
/// thread for it from the default thread pool.
|
||||
{
|
||||
start(ThreadPool::defaultPool());
|
||||
}
|
||||
|
||||
void start(ThreadPool& pool)
|
||||
{
|
||||
FastMutex::ScopedLock lock(_mutex);
|
||||
|
||||
@ -131,7 +136,7 @@ public:
|
||||
_running = true;
|
||||
try
|
||||
{
|
||||
ThreadPool::defaultPool().start(*this);
|
||||
pool.start(*this);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -237,7 +237,7 @@ public:
|
||||
/// Waits for the process specified by handle to terminate
|
||||
/// and returns the exit code of the process.
|
||||
|
||||
static void kill(const ProcessHandle& handle);
|
||||
static void kill(ProcessHandle& handle);
|
||||
/// Kills the process specified by handle.
|
||||
///
|
||||
/// This is preferable on Windows where process IDs
|
||||
|
@ -84,7 +84,7 @@ public:
|
||||
Pipe* outPipe,
|
||||
Pipe* errPipe,
|
||||
const EnvImpl& env);
|
||||
static void killImpl(const ProcessHandleImpl& handle);
|
||||
static void killImpl(ProcessHandleImpl& handle);
|
||||
static void killImpl(PIDImpl pid);
|
||||
static void requestTerminationImpl(PIDImpl pid);
|
||||
|
||||
|
@ -85,7 +85,7 @@ public:
|
||||
Pipe* errPipe,
|
||||
const EnvImpl& env);
|
||||
static int waitImpl(PIDImpl pid);
|
||||
static void killImpl(const ProcessHandleImpl& handle);
|
||||
static void killImpl(ProcessHandleImpl& handle);
|
||||
static void killImpl(PIDImpl pid);
|
||||
static void requestTerminationImpl(PIDImpl pid);
|
||||
};
|
||||
|
@ -86,7 +86,7 @@ public:
|
||||
Pipe* outPipe,
|
||||
Pipe* errPipe,
|
||||
const EnvImpl& env);
|
||||
static void killImpl(const ProcessHandleImpl& handle);
|
||||
static void killImpl(ProcessHandleImpl& handle);
|
||||
static void killImpl(PIDImpl pid);
|
||||
static void requestTerminationImpl(PIDImpl pid);
|
||||
};
|
||||
|
@ -62,7 +62,8 @@ public:
|
||||
UInt32 id() const;
|
||||
HANDLE process() const;
|
||||
int wait() const;
|
||||
|
||||
void closeHandle();
|
||||
|
||||
private:
|
||||
HANDLE _hProcess;
|
||||
UInt32 _pid;
|
||||
@ -89,7 +90,7 @@ public:
|
||||
Pipe* outPipe,
|
||||
Pipe* errPipe,
|
||||
const EnvImpl& env);
|
||||
static void killImpl(const ProcessHandleImpl& handle);
|
||||
static void killImpl(ProcessHandleImpl& handle);
|
||||
static void killImpl(PIDImpl pid);
|
||||
static void requestTerminationImpl(PIDImpl pid);
|
||||
static std::string terminationEventName(PIDImpl pid);
|
||||
|
@ -62,6 +62,7 @@ public:
|
||||
UInt32 id() const;
|
||||
HANDLE process() const;
|
||||
int wait() const;
|
||||
void closeHandle();
|
||||
|
||||
private:
|
||||
HANDLE _hProcess;
|
||||
@ -89,7 +90,7 @@ public:
|
||||
Pipe* outPipe,
|
||||
Pipe* errPipe,
|
||||
const EnvImpl& env);
|
||||
static void killImpl(const ProcessHandleImpl& handle);
|
||||
static void killImpl(ProcessHandleImpl& handle);
|
||||
static void killImpl(PIDImpl pid);
|
||||
static void requestTerminationImpl(PIDImpl pid);
|
||||
static std::string terminationEventName(PIDImpl pid);
|
||||
|
@ -62,7 +62,8 @@ public:
|
||||
UInt32 id() const;
|
||||
HANDLE process() const;
|
||||
int wait() const;
|
||||
|
||||
void closeHandle();
|
||||
|
||||
private:
|
||||
HANDLE _hProcess;
|
||||
UInt32 _pid;
|
||||
@ -89,7 +90,7 @@ public:
|
||||
Pipe* outPipe,
|
||||
Pipe* errPipe,
|
||||
const EnvImpl& env);
|
||||
static void killImpl(const ProcessHandleImpl& handle);
|
||||
static void killImpl(ProcessHandleImpl& handle);
|
||||
static void killImpl(PIDImpl pid);
|
||||
static void requestTerminationImpl(PIDImpl pid);
|
||||
static std::string terminationEventName(PIDImpl pid);
|
||||
|
@ -200,7 +200,7 @@ int Process::wait(const ProcessHandle& handle)
|
||||
}
|
||||
|
||||
|
||||
void Process::kill(const ProcessHandle& handle)
|
||||
void Process::kill(ProcessHandle& handle)
|
||||
{
|
||||
killImpl(*handle._pImpl);
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ ProcessHandleImpl* ProcessImpl::launchByForkExecImpl(const std::string& command,
|
||||
}
|
||||
|
||||
|
||||
void ProcessImpl::killImpl(const ProcessHandleImpl& handle)
|
||||
void ProcessImpl::killImpl(ProcessHandleImpl& handle)
|
||||
{
|
||||
killImpl(handle.id());
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ ProcessHandleImpl* ProcessImpl::launchImpl(const std::string& command, const Arg
|
||||
}
|
||||
|
||||
|
||||
void ProcessImpl::killImpl(const ProcessHandleImpl& handle)
|
||||
void ProcessImpl::killImpl(ProcessHandleImpl& handle)
|
||||
{
|
||||
killImpl(handle.id());
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ ProcessHandleImpl* ProcessImpl::launchImpl(const std::string& command, const Arg
|
||||
}
|
||||
|
||||
|
||||
void ProcessImpl::killImpl(const ProcessHandleImpl& handle)
|
||||
void ProcessImpl::killImpl(ProcessHandleImpl& handle)
|
||||
{
|
||||
throw Poco::NotImplementedException("Process::kill()");
|
||||
}
|
||||
|
@ -56,9 +56,17 @@ ProcessHandleImpl::ProcessHandleImpl(HANDLE hProcess, UInt32 pid):
|
||||
|
||||
ProcessHandleImpl::~ProcessHandleImpl()
|
||||
{
|
||||
CloseHandle(_hProcess);
|
||||
closeHandle();
|
||||
}
|
||||
|
||||
void ProcessHandleImpl::closeHandle()
|
||||
{
|
||||
if (_hProcess)
|
||||
{
|
||||
CloseHandle(_hProcess);
|
||||
_hProcess = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
UInt32 ProcessHandleImpl::id() const
|
||||
{
|
||||
@ -228,17 +236,19 @@ ProcessHandleImpl* ProcessImpl::launchImpl(const std::string& command, const Arg
|
||||
}
|
||||
|
||||
|
||||
void ProcessImpl::killImpl(const ProcessHandleImpl& handle)
|
||||
void ProcessImpl::killImpl(ProcessHandleImpl& handle)
|
||||
{
|
||||
if (TerminateProcess(handle.process(), 0) == 0)
|
||||
if (handle.process())
|
||||
{
|
||||
CloseHandle(handle.process());
|
||||
throw SystemException("cannot kill process");
|
||||
if (TerminateProcess(handle.process(), 0) == 0)
|
||||
{
|
||||
handle.closeHandle();
|
||||
throw SystemException("cannot kill process");
|
||||
}
|
||||
handle.closeHandle();
|
||||
}
|
||||
CloseHandle(handle.process());
|
||||
}
|
||||
|
||||
|
||||
void ProcessImpl::killImpl(PIDImpl pid)
|
||||
{
|
||||
HANDLE hProc = OpenProcess(PROCESS_TERMINATE, FALSE, pid);
|
||||
|
@ -57,9 +57,17 @@ ProcessHandleImpl::ProcessHandleImpl(HANDLE hProcess, UInt32 pid):
|
||||
|
||||
ProcessHandleImpl::~ProcessHandleImpl()
|
||||
{
|
||||
CloseHandle(_hProcess);
|
||||
closeHandle();
|
||||
}
|
||||
|
||||
void ProcessHandleImpl::closeHandle()
|
||||
{
|
||||
if (_hProcess)
|
||||
{
|
||||
CloseHandle(_hProcess);
|
||||
_hProcess = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
UInt32 ProcessHandleImpl::id() const
|
||||
{
|
||||
@ -234,17 +242,19 @@ ProcessHandleImpl* ProcessImpl::launchImpl(const std::string& command, const Arg
|
||||
}
|
||||
|
||||
|
||||
void ProcessImpl::killImpl(const ProcessHandleImpl& handle)
|
||||
void ProcessImpl::killImpl(ProcessHandleImpl& handle)
|
||||
{
|
||||
if (TerminateProcess(handle.process(), 0) == 0)
|
||||
if (handle.process())
|
||||
{
|
||||
CloseHandle(handle.process());
|
||||
throw SystemException("cannot kill process");
|
||||
if (TerminateProcess(handle.process(), 0) == 0)
|
||||
{
|
||||
handle.closeHandle();
|
||||
throw SystemException("cannot kill process");
|
||||
}
|
||||
handle.closeHandle();
|
||||
}
|
||||
CloseHandle(handle.process());
|
||||
}
|
||||
|
||||
|
||||
void ProcessImpl::killImpl(PIDImpl pid)
|
||||
{
|
||||
HANDLE hProc = OpenProcess(PROCESS_TERMINATE, FALSE, pid);
|
||||
|
@ -57,9 +57,17 @@ ProcessHandleImpl::ProcessHandleImpl(HANDLE hProcess, UInt32 pid):
|
||||
|
||||
ProcessHandleImpl::~ProcessHandleImpl()
|
||||
{
|
||||
CloseHandle(_hProcess);
|
||||
closeHandle();
|
||||
}
|
||||
|
||||
void ProcessHandleImpl::closeHandle()
|
||||
{
|
||||
if (_hProcess)
|
||||
{
|
||||
CloseHandle(_hProcess);
|
||||
_hProcess = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
UInt32 ProcessHandleImpl::id() const
|
||||
{
|
||||
@ -158,14 +166,17 @@ ProcessHandleImpl* ProcessImpl::launchImpl(const std::string& command, const Arg
|
||||
}
|
||||
|
||||
|
||||
void ProcessImpl::killImpl(const ProcessHandleImpl& handle)
|
||||
void ProcessImpl::killImpl(ProcessHandleImpl& handle)
|
||||
{
|
||||
if (TerminateProcess(handle.process(), 0) == 0)
|
||||
if (handle.process())
|
||||
{
|
||||
CloseHandle(handle.process());
|
||||
throw SystemException("cannot kill process");
|
||||
if (TerminateProcess(handle.process(), 0) == 0)
|
||||
{
|
||||
handle.closeHandle();
|
||||
throw SystemException("cannot kill process");
|
||||
}
|
||||
handle.closeHandle();
|
||||
}
|
||||
CloseHandle(handle.process());
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user