diff --git a/qse/include/qse/si/App.hpp b/qse/include/qse/si/App.hpp index dbc385bd..ed254625 100644 --- a/qse/include/qse/si/App.hpp +++ b/qse/include/qse/si/App.hpp @@ -24,8 +24,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _QSE_SI_APP_H_ -#define _QSE_SI_APP_H_ +#ifndef _QSE_SI_APP_HPP_ +#define _QSE_SI_APP_HPP_ #include #include @@ -59,6 +59,7 @@ class App: public Uncopyable, public Types, public Mmged, public Named<32> { public: typedef QSE::Bitset SignalSet; + typedef long int child_pid_t; enum SignalState { @@ -220,7 +221,7 @@ private: }; _SigLink _sig[QSE_NSIGS]; - long int _guarded_child_pid; + child_pid_t _guarded_child_pid; qse_cmgr_t* _cmgr; struct log_t @@ -245,6 +246,15 @@ private: static void handle_signal (int sig) QSE_CPP_NOEXCEPT; static int put_char_to_log_buf (qse_char_t c, void* ctx) QSE_CPP_NOEXCEPT; + +protected: + enum guarded_child_state_t + { + GUARDED_CHILD_STARTED, + GUARDED_CHILD_EXITED + }; + + void on_guarded_child (child_pid_t pid, guarded_child_state_t state, int status) QSE_CPP_NOEXCEPT {}; }; ///////////////////////////////// diff --git a/qse/include/qse/si/Condition.hpp b/qse/include/qse/si/Condition.hpp index 8cce78a4..1aa2b8a7 100644 --- a/qse/include/qse/si/Condition.hpp +++ b/qse/include/qse/si/Condition.hpp @@ -24,8 +24,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _QSE_SI_CONDITION_CLASS_ -#define _QSE_SI_CONDITION_CLASS_ +#ifndef _QSE_SI_CONDITION_HPP_ +#define _QSE_SI_CONDITION_HPP_ #include #include diff --git a/qse/include/qse/si/Mutex.hpp b/qse/include/qse/si/Mutex.hpp index 8602312a..808800b6 100644 --- a/qse/include/qse/si/Mutex.hpp +++ b/qse/include/qse/si/Mutex.hpp @@ -24,8 +24,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _QSE_SI_MUTEX_CLASS_ -#define _QSE_SI_MUTEX_CLASS_ +#ifndef _QSE_SI_MUTEX_HPP_ +#define _QSE_SI_MUTEX_HPP_ #include #include diff --git a/qse/include/qse/si/Path.hpp b/qse/include/qse/si/Path.hpp index c56edfcd..1d0d0f4e 100644 --- a/qse/include/qse/si/Path.hpp +++ b/qse/include/qse/si/Path.hpp @@ -24,8 +24,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _QSE_SI_PATH_CLASS_ -#define _QSE_SI_PATH_CLASS_ +#ifndef _QSE_SI_PATH_HPP_ +#define _QSE_SI_PATH_HPP_ #include #include diff --git a/qse/include/qse/si/SpinLock.hpp b/qse/include/qse/si/SpinLock.hpp index 0568e76b..53fc8838 100644 --- a/qse/include/qse/si/SpinLock.hpp +++ b/qse/include/qse/si/SpinLock.hpp @@ -24,8 +24,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _QSE_SI_SPINLOCK_CLASS_ -#define _QSE_SI_SPINLOCK_CLASS_ +#ifndef _QSE_SI_SPINLOCK_HPP_ +#define _QSE_SI_SPINLOCK_HPP_ #include #include diff --git a/qse/include/qse/si/TcpServer.hpp b/qse/include/qse/si/TcpServer.hpp index 7b01c1eb..c247e340 100644 --- a/qse/include/qse/si/TcpServer.hpp +++ b/qse/include/qse/si/TcpServer.hpp @@ -24,8 +24,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _QSE_SI_TCPSERVER_CLASS_ -#define _QSE_SI_TCPSERVER_CLASS_ +#ifndef _QSE_SI_TCPSERVER_HPP_ +#define _QSE_SI_TCPSERVER_HPP_ #include #include diff --git a/qse/include/qse/si/Thread.hpp b/qse/include/qse/si/Thread.hpp index 4fa64816..76a742ac 100644 --- a/qse/include/qse/si/Thread.hpp +++ b/qse/include/qse/si/Thread.hpp @@ -24,8 +24,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _QSE_SI_THREAD_CLASS_ -#define _QSE_SI_THREAD_CLASS_ +#ifndef _QSE_SI_THREAD_HPP_ +#define _QSE_SI_THREAD_HPP_ #include #include diff --git a/qse/lib/si/App.cpp b/qse/lib/si/App.cpp index 12d72ed3..7a0acf4b 100644 --- a/qse/lib/si/App.cpp +++ b/qse/lib/si/App.cpp @@ -543,6 +543,7 @@ int App::guardProcess (const SignalSet& signals, bool _guard, qse_mtime_t guard_ // the guardian(parent) process // =============================================== this->_guarded_child_pid = pid; + this->on_guarded_child (pid, GUARDED_CHILD_STARTED, 0); int status; while (::waitpid(pid, &status, 0) != pid) @@ -555,6 +556,7 @@ int App::guardProcess (const SignalSet& signals, bool _guard, qse_mtime_t guard_ // ------------------------------------------------------ } + this->on_guarded_child (pid, GUARDED_CHILD_EXITED, status); if (WIFEXITED(status)) { if (WEXITSTATUS(status) == 0)