00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef __TTEST__DEFINED
00012 #define __TTEST__DEFINED
00013
00014 #include "timer.hh"
00015 #include <stdio.h>
00016 #include <unistd.h>
00017
00018 extern timespec TICK_INTERVAL;
00019
00020 class Timer_test : public Timer_thread
00021 {
00022 public:
00023 Timer_test() : Timer_thread(), count_(0) {};
00024 void tick();
00025 ~Timer_test()
00026 {
00027 printf("Timer terminated.\n");
00028 }
00029 private:
00030 int count_;
00031 };
00032
00033 class Timer_test_proxy
00034 {
00035 public:
00036 Timer_test_proxy(timespec& ts = TICK_INTERVAL)
00037 {
00038 int pid = t_.start(ts);
00039 printf("Timer started: pid %d (getpid returned %d)\nPress any key to stop.\n",
00040 pid, getpid());
00041 }
00042 int proxy_error()
00043 {
00044 return t_.get_pid() == -1;
00045 }
00046 ~Timer_test_proxy()
00047 {
00048 t_.stop();
00049 }
00050 private:
00051 Timer_test t_;
00052 };
00053
00054 #endif