Author: janderwald
Date: Thu Oct 11 22:41:39 2007
New Revision: 29509
URL:
http://svn.reactos.org/svn/reactos?rev=29509&view=rev
Log:
- add checkAlarms function
- this function will be used to determine wether expiration alarms are active. If qemu
dies or terminates unexpectly, this function will check if it was before an timeout. In
that case alarms will be active. Note: if qemu is killed purposely,
OsSupport::cancelAlarms must be called to prevent automatic termination of sysreg process
Modified:
trunk/reactos/tools/sysreg/os_support.cpp
trunk/reactos/tools/sysreg/os_support.h
Modified: trunk/reactos/tools/sysreg/os_support.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/sysreg/os_support.cp…
==============================================================================
--- trunk/reactos/tools/sysreg/os_support.cpp (original)
+++ trunk/reactos/tools/sysreg/os_support.cpp Thu Oct 11 22:41:39 2007
@@ -15,7 +15,7 @@
OsSupport::TimeEntryVector OsSupport::s_Entries;
//int gettimeofday(struct timeval *tv, void * tz);
-
+//------------------------------------------------------------------------
void OsSupport::checkAlarms()
{
struct timeval tm;
@@ -44,7 +44,11 @@
}
#endif
}
-
+ bool OsSupport::hasAlarms ()
+ {
+ return (s_Entries.size () != 0);
+ }
+//------------------------------------------------------------------------
void OsSupport::cancelAlarms()
{
@@ -284,6 +288,18 @@
{
OsSupport::checkAlarms();
}
+ else if (sig == SIGCHLD)
+ {
+ if (OsSupport::hasAlarms())
+ {
+ ///
+ /// FIXME
+ ///
+ /// there are expiriation alarms active and a child died unexpectly
+ /// lets commit suicide
+ exit(-2);
+ }
+ }
}
void OsSupport::setAlarm(long secs, OsSupport::ProcessID pid)
{
Modified: trunk/reactos/tools/sysreg/os_support.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/sysreg/os_support.h?…
==============================================================================
--- trunk/reactos/tools/sysreg/os_support.h (original)
+++ trunk/reactos/tools/sysreg/os_support.h Thu Oct 11 22:41:39 2007
@@ -120,6 +120,13 @@
static void checkAlarms();
+///---------------------------------------------------------------------------------------
+///
+/// hasAlarms
+///
+/// Description: this function checks wether there are alarms set active
+
+ static bool hasAlarms();
protected:
//---------------------------------------------------------------------------------------