26.02.2014 Views

Getting Started with QNX Neutrino - QNX Software Systems

Getting Started with QNX Neutrino - QNX Software Systems

Getting Started with QNX Neutrino - QNX Software Systems

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Clocks and timers<br />

© 2009, <strong>QNX</strong> <strong>Software</strong> <strong>Systems</strong> GmbH & Co. KG.<br />

Note that the sigev_coid could be a connection to any channel (usually, though not<br />

necessarily, the channel associated <strong>with</strong> the process that’s initiating the event).<br />

Signal notification<br />

To send a signal, set the sigev_notify field to one of:<br />

SIGEV_SIGNAL<br />

Send a regular signal to the process.<br />

SIGEV_SIGNAL_CODE<br />

Send a signal containing an 8-bit code to the process.<br />

SIGEV_SIGNAL_THREAD<br />

Send a signal containing an 8-bit code to a specific thread.<br />

For SIGEV_SIGNAL*, the additional fields you’ll have to fill are:<br />

Field<br />

sigev_signo<br />

sigev_code<br />

Value and meaning<br />

Signal number to send (from , e.g., SIGALRM).<br />

An 8-bit code (if using SIGEV_SIGNAL_CODE or<br />

SIGEV_SIGNAL_THREAD).<br />

Thread notification<br />

To create a thread whenever the timer fires, set the sigev_notify field to<br />

SIGEV_THREAD and fill these fields:<br />

Field<br />

sigev_notify_function<br />

sigev_value<br />

sigev_notify_attributes<br />

Value and meaning<br />

Address of void * function that accepts a void * to be<br />

called when the event triggers.<br />

Value passed as the parameter to the<br />

sigev_notify_function() function.<br />

Thread attributes structure (see the Processes and Threads<br />

chapter, under “The thread attributes structure” for<br />

details).<br />

144 Chapter 3 • Clocks, Timers, and <strong>Getting</strong> a Kick Every So Often April 30, 2009

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!