interval_timer
|
 |
To deliver a signal to the
current process after a specified time, program an interval timer. An interval
timer can deliver a signal once or periodically. Following are the methods of
counting time.
- Real time-Timer decrements
in real clock time and sends a
SIGALRM
signal to the current process upon expiration.
- Virtual time-Timer only
decrements when the current process is running and sends a
SIGVTALRM
signal to the current process upon expiration.
- Profile time-Timer only
decrements when the current process is running, or the kernel is executing
on its behalf, and sends a
SIGPROF
signal to the current process upon expiration.
All timers are disabled by
default. To access these timers, you must use the interval timer interface of os_this_process
; these timers cannot be constructed directly.
Library
Platform<ToolKit> for
UNIX
Declaration
#include <ospace/unix/inttimer.h>
class os_interval_timer
Interface
Constructor
os_interval_timer()
Constructs an idle timer.
Constructor
os_interval_timer(
const os_interval_timer& timer )
Constructs a copy of timer
.
<
bool
operator<( const os_interval_timer& timer
) const
Returns true
if the timer is considered to be less than timer .
=
os_interval_timer&
operator=( const os_interval_timer& timer
)
Assigns a timer from timer
.
==
bool
operator==( const os_interval_timer& timer
) const
Returns true
if this is the same kind of timer as timer .
active
bool
active() const
Returns true
if currently active.
Throws: os_unix_toolkit_error
cancel
void
cancel()
Cancels timer
immediately.
Throws: os_unix_toolkit_error
cancel_after
expiration
void
cancel_after_expiration()
Cancels timer after the
next expiration.
Throws: os_unix_toolkit_error
defined
bool
defined() const
Returns true
if type is not OS_UNDEFINED .
print
void
print( ostream& stream ) const
Prints type to stream
.
Throws: os_unix_toolkit_error
repeat_interval
os_time_period
repeat_interval() const
If object is a repeating
timer, returns the repeating interval duration. If not a repeating timer,
returns zero.
Throws: os_unix_toolkit_error
repeat_timer
void
repeat_timer( const os_time_period& period
)
Sets object to be a
repeating timer that expires every period .
Throws: os_unix_toolkit_error
time_left
os_time_period
time_left() const
Returns the time left
until object expires.
Throws: os_unix_toolkit_error
timer
void
timer( const os_time_period& period )
Expires exactly once
after period has passed.
Throws: os_unix_toolkit_error
type
int
type() const
Returns the encoding
value ( real = 0 ,
virtual = 1 , profile = 2
).
Non-Member Functions
<<
ostream&
operator<<( ostream& stream ,
const os_interval_timer& timer )
Prints timer
to stream .
Throws: os_unix_toolkit_error
Copyright©1994-2026 Recursion
Software LLC
All Rights Reserved - For use by licensed users only. - For use by licensed
users only.