Pylon::WaitObject#
#include <pylon/WaitObject.h>
Inherited by Pylon::WaitObjectEx
Public Functions#
Name | |
---|---|
WaitObject() Constructs an "empty" wait object, i.e., the wait object is not attached to a platform dependent wait object (IsValid() == false) | |
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. |
bool | Wait(unsigned int timeout) const Wait for the object to be signaled. |
EWaitExResult | WaitEx(unsigned int timeout, bool bAlertable) const Wait for the object to be signaled (interruptible) |
WaitObject(WaitObject_t h, bool duplicate =true) Constructor taking existing handle (duplicate=false -> take ownership like std:auto_ptr) | |
operator WaitObject_t() const conversion operator | |
void | Sleep(unsigned long ms) Suspend calling thread for specified time. |
Detailed Description#
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.
Public Functions Documentation#
function 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.
function ~WaitObject#
Destructor.
function WaitObject#
Copy constructor (duplicates the wrapped handle/file descriptor)
function operator=#
Assignment operator (duplicates the wrapped handle/file descriptor)
function IsValid#
Checks if the wait object is valid.
Return: true if the object contains a valid handle/file descriptor
Don't call the Wait methods() for an invalid wait object. Wait objects returned by the pylon libraries are valid.
function Wait#
Wait for the object to be signaled.
Parameters:
- timeout timeout in ms
Return: false when the timeout has been expired, true when the waiting was successful before the timeout has been expired.
function WaitEx#
Wait for the object to be signaled (interruptible)
Parameters:
- 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.
Return: The returned Pylon::EWaitExResult value indicates the result of the wait operation.
function WaitObject#
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.
function operator WaitObject_t#
conversion operator
Return: the native Win32 handle wrapped by the WaitObject. (Not supported by pylon4Linux)
function Sleep#
Suspend calling thread for specified time.
Parameters:
- ms wait time in ms