MAK RTIspy API Documentation for HLA Evolved
9 - Finding Out when Data is Available to be Read

Some applications want to avoid excessive polling of the RTI - calling tick() repeatedly even when no data is available to be read.

The MAK RTI lets you find out when data is available to be read in an event-based fashion.

Federates can call the DtReadFileDescriptor() member function, declared in makRti.h, to obtain a file descriptor on which data will be present whenever there is incoming data waiting to be processed by the RTI:

int DtReadFileDescriptor(RTI::RTIambssador* amb, RTI::TransportType transport);

A separate file descriptor is used to signal the presence of reliable versus best effort data. The file descriptor can be used in calls like select() to avoid unnecessary polling.

On Windows, this function works only if you are not using asynchronous mode. If you are using asynchronous mode, DtReadFileDescriptor() returns -1, and you must use an alternate method to avoid polling. The DtReadFileEvent() member function (also declared in makRti.h), returns a WIN32 event handle that signals when data is available to be read:

WSAEVENT DtReadFileEvent(RTI::RTIambassador* amb, RTI::TransportType transport);

This function can be used in calls such as WaitForSingleObject to avoid polling.

Note
These functions are not part of the standard RTI API. If you rely on these functions, you will not be able to switch to other RTI implementations without recompiling (and avoiding these functions).

[<< Responding to Dropped Federates ] [Home] [rtiexec Plug-ins >>]


Document ID: Generated on Tue May 7 16:26:47 EDT 2013 from SVN revision 126903
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)