A platform independent wait object. More...
#include <pylon/WaitObject.h>
Public Member Functions | |
WaitObject () | |
Constructs an "empty" wait object, i.e., the wait object is not attached to a platform dependent wait object (IsValid() == false) More... | |
virtual | ~WaitObject () |
Destructor. | |
WaitObject (const WaitObject &) | |
Copy constructor (duplicates the wrapped handle/file descriptor) | |
WaitObject & | operator= (const WaitObject &) |
Assignment operator (duplicates the wrapped handle/file descriptor) | |
bool | IsValid () const |
Checks if the wait object is valid. More... | |
bool | Wait (unsigned int timeout) const |
Wait for the object to be signaled. More... | |
EWaitExResult | WaitEx (unsigned int timeout, bool bAlertable) const |
Wait for the object to be signaled (interruptible) More... | |
WaitObject (WaitObject_t h, bool duplicate=true) | |
Constructor taking existing handle (duplicate=false -> take ownership like std:auto_ptr) More... | |
void | Destroy () |
Invalidates the internal wait object. | |
int | GetFd (void) const |
Getter for file descriptor. More... | |
ready_mask_t | GetReadyMask () const |
Indicates to what kind of file descriptor set the wrapped file descriptor must be put for usage with the select() or poll() function. | |
operator struct _WaitObjectPosix_t * () const | |
conversion operator More... | |
WaitObject_t & | GetWaitObject () |
Accessor to internal wait object (not supported by pylon for Windows) | |
Static Public Member Functions | |
static void | Sleep (unsigned long ms) |
Suspend calling thread for specified time. More... | |
A platform independent wait object.
Wait objects are used by the Pylon::IStreamGrabber and Pylon::IEventGrabber interfaces to provide a platform independent mechanism for allowing an application to wait for data buffers to be filled.
For the Windows version of pylon, WaitObjects are wrappers for Win32 objects that can be used with WaitForSingleObject()
and WaitForMultipleObjects()
.
For the Linux version of pylon, WaitObjects are implemented based on file descriptors. The wait operation is implemented using the poll()
function.
Although the class provides a default constructor, the default constructor doesn't create a "usable" wait objects wrapping a handle resp. file descriptor. Valid instances of Pylon::WaitObject cannot be created by the application, instead the pylon libraries return fully created wait objects. The Pylon::WaitObjectEx class can be used to create wait objects that can be controlled by the application.
The Pylon::WaitObject class provides access to the wrapped handle resp. file descriptor. This allows to use to allow use pylon wait objects as input for "native" APIs like WaitForMultipleObjects()
(Windows), and poll()
(Linux).
Multiple Pylon::WaitObjects can be put in the Pylon::WaitObjects container class allowing to wait "simultaneously" for multiple events.
Pylon::WaitObject::WaitObject | ( | ) |
Constructs an "empty" wait object, i.e., the wait object is not attached to a platform dependent wait object (IsValid() == false)
The Pylon::WaitObjectEx class can be used to create wait objects controllable by an application.
Pylon::WaitObject::WaitObject | ( | WaitObject_t | h, |
bool | duplicate = true |
||
) |
Constructor taking existing handle (duplicate=false -> take ownership like std:auto_ptr)
This method allows to wrap an existing windows handle that can be used with the WaitForSingleObject()
and WaitForMultipleObjects
methods.
int Pylon::WaitObject::GetFd | ( | void | ) | const |
Getter for file descriptor.
select()
or poll() function can be used to wait for pylon and non-pylon events simultaneously. bool Pylon::WaitObject::IsValid | ( | ) | const |
Checks if the wait object is valid.
Don't call the Wait methods() for an invalid wait object. Wait objects returned by the pylon libraries are valid.
Pylon::WaitObject::operator struct _WaitObjectPosix_t * | ( | ) | const |
conversion operator
|
static |
Suspend calling thread for specified time.
ms | wait time in ms |
bool Pylon::WaitObject::Wait | ( | unsigned int | timeout | ) | const |
Wait for the object to be signaled.
timeout | timeout in ms |
EWaitExResult Pylon::WaitObject::WaitEx | ( | unsigned int | timeout, |
bool | bAlertable | ||
) | const |
Wait for the object to be signaled (interruptible)
timeout | timeout in ms |
bAlertable | When the bAlertable parameter is set to true, the function waits until either the timeout elapses, the object enters the signaled state, or the wait operation has been interrupted. For Windows, the wait operation is interrupted by queued APCs or I/O completion routines. For Linux, the wait operation can be interrupted by signals. |