00001 /*----------------------------------------------------------------------------* 00002 * Copyright (c) 2005 Southeastern Universities Research Association, * 00003 * Thomas Jefferson National Accelerator Facility * 00004 * * 00005 * This software was developed under a United States Government license * 00006 * described in the NOTICE file included as part of this distribution. * 00007 * * 00008 * E.Wolin, 31-Oct-2006, Jefferson Lab * 00009 * * 00010 * Authors: Elliott Wolin * 00011 * wolin@jlab.org Jefferson Lab, MS-6B * 00012 * Phone: (757) 269-7365 12000 Jefferson Ave. * 00013 * Fax: (757) 269-5519 Newport News, VA 23606 * 00014 * 00015 *----------------------------------------------------------------------------*/ 00016 00017 #ifndef _PollingService_hxx 00018 #define _PollingService_hxx 00019 00020 00021 #include <InterruptibleObject.hxx> 00022 #include <time.h> 00023 #include <pthread.h> 00024 00025 00026 namespace codaObject { 00027 00028 00029 //----------------------------------------------------------------------------- 00030 //----------------------------------------------------------------------------- 00031 00032 00036 class PollingService : public InterruptService { 00037 00038 public: 00039 explicit PollingService(int timeout); 00040 virtual bool setupInterrupt(void); 00041 virtual bool enableInterrupt(void); 00042 virtual bool pauseInterrupt(void); 00043 virtual bool resumeInterrupt(void); 00044 virtual bool deleteInterrupt(void); 00045 00046 virtual void* dispatchInterrupt(void*); 00047 00048 00049 private: 00050 pthread_t pollingThreadId; 00051 int pollingTimeout; 00053 pthreadDispatcher<PollingService,void*,void*> *pollingPthreadDispatcher; 00054 }; 00055 00056 00057 //----------------------------------------------------------------------------- 00058 //----------------------------------------------------------------------------- 00059 00060 00061 } // namespace codaObject 00062 00063 #endif /* PollingService_hxx */