#include <TimerSignal.hpp>
Inheritance diagram for TimerSignal::
Public Methods | |
TimerSignal (ULONG nsec=Period_500_ms, ULONG sec=0) | |
virtual __inline void | start () |
virtual __inline void | stop () |
void | set (ULONG nsec=Period_500_ms, ULONG sec=0) |
Protected Methods | |
virtual void | tick (int signo)=0 |
Static Protected Methods | |
void | wrapper (int signo) |
Static Protected Attributes | |
TimerSignal * | theTimer = NULL |
Private Attributes | |
timer_t | timer_id |
sigevent | event |
itimerspec | t |
|
Definition at line 10 of file TimerSignal.cpp. 00011 { 00012 /* 00013 if ( theTimer != NULL ) { 00014 delete theTimer; 00015 } 00016 00017 theTimer = this; 00018 00019 memset( &event, 0, sizeof( event ) ); 00020 */ 00021 00022 // sched_get_priority_max( SCHED_RR ) == 63 00023 00024 event.sigev_priority = getprio( 0 ); // fixprio( 20 ); 00025 00026 event.sigev_notify = SIGEV_SIGNAL; 00027 event.sigev_signo = TimerSignalEvent; 00028 00029 // memset( &t, 0, sizeof( t ) ); 00030 00031 // create the timer, binding it to the event 00032 00033 if ( timer_create( CLOCK_REALTIME, &event, &timer_id ) == -1 ) 00034 { 00035 MC_OnError( errno, Error, "while creating a timer." ) 00036 } 00037 00038 struct sigaction act; 00039 sigset_t set_event; 00040 00041 sigemptyset( &set_event ); 00042 sigaddset( &set_event, TimerSignalEvent ); 00043 00044 // Define a handler for TimerSignalEvent 00045 act.sa_flags = 0; 00046 act.sa_mask = set_event; 00047 act.sa_handler = wrapper; 00048 00049 sigaction( TimerSignalEvent, &act, NULL ); 00050 00051 set( nsec, sec ); 00052 } |
|
Definition at line 55 of file TimerSignal.cpp. Referenced by TimerSignal(), and stop().
|
|
Reimplemented in Timing, and TimerTest. Definition at line 4 of file TimerSignal.inl. Referenced by TimerTest::start(), theTimer(), and Timer::theTimer().
00005 { 00006 timer_settime( timer_id, 0, &t, NULL ); 00007 } |
|
Definition at line 9 of file TimerSignal.inl. 00010 { 00011 set( 0, 0 ); 00012 } |
|
Reimplemented in TimerTest. Referenced by wrapper(), and Timer::wrapper().
|
|
Definition at line 65 of file TimerSignal.hpp. |
|
Definition at line 77 of file TimerSignal.hpp. |
|
Definition at line 78 of file TimerSignal.hpp. |
|
Definition at line 7 of file TimerSignal.cpp. |
|
Definition at line 76 of file TimerSignal.hpp. |