U of I CS 241 - Real Time Interval Timers (17 pages)

Previewing pages 1, 2, 3, 4, 5, 6 of 17 page document View the full content.
View Full Document

Real Time Interval Timers



Previewing pages 1, 2, 3, 4, 5, 6 of actual document.

View the full content.
View Full Document
View Full Document

Real Time Interval Timers

107 views


Pages:
17
School:
University of Illinois
Course:
Cs 241 - Intermediate Programming in C++
Intermediate Programming in C++ Documents

Unformatted text preview:

Real Time Interval Timers CS 241 Lecture 19 T Ch 3 pp 159 183 Roy Campbell 01 13 19 CS241 2005 Roy Campbell All R ights Reserved 1 Real Time Signals include signal h Struct sigaction void sa handler int SIG DFL SIG IGN or pointer to function sigset t sa mask additional signals to be blocked during execution of handler int sa flags special flags and options void sa sigaction int siginfo t void realtime handler Handler looks like void func int signo siginfo t info void context 01 13 19 CS241 2005 Roy Campbell All R ights Reserved 2 SIGINFO Tstructure int si signo signal number int si code cause of signal union sigval si value signal value c union sigval is defined as int sival int void sival ptr 01 13 19 CS241 2005 Roy Campbell All R ights Reserved 3 POSIX RTS signal queueing include signal h int sigqueue pid t pid int signo const union sigval value sigqueue extends kill Multiple signals created by kill may not be queued but they are if created by sigqueue Signo should be non zero If zero will check for errors can use this to see if pid valid see p322 SA SIGINFO is in sa flags of struct sigaction thensignal queued otherwise signal sent at least once 01 13 19 CS241 2005 Roy Campbell All R ights Reserved 4 Send a queued signal to a process include signal h include stdio h include stdlib h int main int argc char argv int pid int signo int sval union sigval value if argc 4 fprintf stderr Usage s pid signal value n argv 0 return 1 01 13 19 CS241 2005 Roy Campbell All R ights Reserved 5 Send a queued signal to a process pid atoi argv 1 signo atoi argv 2 sval atoi argv 3 fprintf stderr Sending signal d with value d to process d n signo sval pid value sival int sval if sigqueue pid signo value 1 perror Failed to send the signal return 1 return 0 01 13 19 CS241 2005 Roy Campbell All R ights Reserved 6 POSIX TMR Interval Timers struct itimerspec struct timespec it interval timer period struct timespec it value timer expiration timer create creates timers they are NOT inherited



View Full Document

Access the best Study Guides, Lecture Notes and Practice Exams

Loading Unlocking...
Login

Join to view Real Time Interval Timers and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Real Time Interval Timers and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?