Fresco/Prague/include/Prague/Sys Fork.hh,1.7,1.8 Process.hh,1.6,1.7 Signal.hh,1.10,1.11 Stopwatch.hh,1.5,1.6
Tobias Hunger <[email protected]> Fri, 07 Nov 2003 23:46:38 +0000
| Newsgroups | gmane.comp.video.fresco.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvs/fresco/Fresco/Prague/include/Prague/Sys
In directory purcel:/tmp/cvs-serv6616/Prague/include/Prague/Sys
Modified Files:
Fork.hh Process.hh Signal.hh Stopwatch.hh
Log Message:
Throw std::runtime_error instead of using perror function in Prague.
Closes bug281.
Index: Fork.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Prague/include/Prague/Sys/Fork.hh,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- Fork.hh 3 Nov 2003 17:53:53 -0000 1.7
+++ Fork.hh 7 Nov 2003 23:46:36 -0000 1.8
@@ -47,7 +47,8 @@
//. return the child process id
pid_t pid() const;
//. commit suicide at the signal signo
- static void suicide_on_signal(Signal::type signo = Signal::terminate);
+ static void suicide_on_signal(Signal::type signo = Signal::terminate)
+ throw(std::runtime_error);
private:
Process *process;
Fork (const Fork &);
Index: Process.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Prague/include/Prague/Sys/Process.hh,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- Process.hh 31 Oct 2003 22:33:10 -0000 1.6
+++ Process.hh 7 Nov 2003 23:46:36 -0000 1.7
@@ -24,6 +24,7 @@
#include <cstdio>
#include <cerrno>
+#include <stdexcept>
#include <unistd.h>
#include <sys/time.h>
#include <sys/resource.h>
@@ -39,9 +40,10 @@
~Process() { }
double cpu() const { return 0.; }
long memory() const { return _usage.ru_idrss; }
- void update()
+ void update() throw(std::runtime_error)
{
- if (getrusage(RUSAGE_SELF, &_usage) == -1) perror("Process::update:");
+ if (getrusage(RUSAGE_SELF, &_usage) == -1)
+ throw std::runtime_error("Process::update: " + strerror(errno));
}
//. return the process' id
static pid_t id() { return getpid(); }
Index: Signal.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Prague/include/Prague/Sys/Signal.hh,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- Signal.hh 3 Nov 2003 17:53:53 -0000 1.10
+++ Signal.hh 7 Nov 2003 23:46:36 -0000 1.11
@@ -96,7 +96,7 @@
//. don't ignore the specified signal any more
static void unmask(type, type);
//. is there a pending signal of type signum (while being blocked)
- static bool ispending(type);
+ static bool ispending(type) throw(std::runtime_error);
//. is there any pending signal (while being blocked)
static sigset_t pending();
static void sysresume(type, bool);
Index: Stopwatch.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Prague/include/Prague/Sys/Stopwatch.hh,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Stopwatch.hh 31 Oct 2003 22:33:10 -0000 1.5
+++ Stopwatch.hh 7 Nov 2003 23:46:36 -0000 1.6
@@ -24,6 +24,7 @@
#include <sys/types.h>
#include <ctime>
+#include <stdexcept>
namespace Prague
{
@@ -41,9 +42,9 @@
Stopwatch();
~Stopwatch(){}
//. start the stopwatch
- void start();
+ void start() throw(std::runtime_error);
//. stop the stopwatch
- void stop();
+ void stop() throw(std::runtime_error);
//. return real elapsed time
double real_time();
//. return cpu elapsed time