00001 00012 #ifndef NETCONNWATCHDOG_H 00013 #define NETCONNWATCHDOG_H 00014 00015 #include <pthread.h> 00016 00017 class NetConnWatchdog { 00018 public: 00022 enum Status { 00024 OPEN = 1, 00026 CLOSED = 0, 00028 ERROR = -1 00029 }; 00030 00035 static NetConnWatchdog * theInstance(); 00036 00041 int start(); 00042 00047 int stop(); 00048 00053 void countDown(); 00054 00058 void addTick(); 00059 00064 inline int getInTicker(){return inTicker;} 00065 00066 protected: 00067 00071 NetConnWatchdog(); 00072 00076 ~NetConnWatchdog(); 00077 00078 private: 00083 static void tick(); 00084 00089 int error(); 00090 00092 int inTicker; 00093 00095 Status status; 00096 00098 pthread_t tThread; 00099 00100 }; 00101 00102 #endif