MeVisLab Toolbox Reference
ml::BackgroundTaskMessageQueue Class Reference

#include <mlBackgroundTaskMessageQueue.h>

Public Member Functions

 BackgroundTaskMessageQueue ()
 
 ~BackgroundTaskMessageQueue ()
 
BackgroundTaskMessagewaitForMessage ()
 wait for the next message (the returned message is owned by the user and needs to be deleted by the user) the message can be NULL, when the task was canceled (should be only called in worker thread) (threadsafe)
 
void addMessage (BackgroundTaskMessage *message)
 put the message into the queue, pass ownership to the queue (do not delete the message!) (threadsafe)
 
BackgroundTaskMessagenextMessage ()
 Returns the next message without blocking, returns NULL if no message was available.
 
BackgroundTaskMessagenextMessage (int &availableMessages)
 Returns the next message and the number of available messages (including the returned message) without blocking, returns NULL if no message was available.
 
BackgroundTaskMessagenextMessageNoLock ()
 Returns the next message without locking the queue (ONLY use for synchronous case!).
 
void removeMessagesForReceiver (BackgroundTaskMessageReceiver *receiver)
 Remove all messages for the given receiver.
 
bool isCanceled () const
 Returns if the queue has been canceled.
 
void cancel ()
 Sets that the queue is canceled.
 
void cancelAndNotify ()
 Sets that the queue is canceled and notifies it if it is waiting for new messages.
 

Detailed Description

Definition at line 32 of file mlBackgroundTaskMessageQueue.h.

Constructor & Destructor Documentation

◆ BackgroundTaskMessageQueue()

ml::BackgroundTaskMessageQueue::BackgroundTaskMessageQueue ( )

◆ ~BackgroundTaskMessageQueue()

ml::BackgroundTaskMessageQueue::~BackgroundTaskMessageQueue ( )

Member Function Documentation

◆ addMessage()

void ml::BackgroundTaskMessageQueue::addMessage ( BackgroundTaskMessage * message)

put the message into the queue, pass ownership to the queue (do not delete the message!) (threadsafe)

◆ cancel()

void ml::BackgroundTaskMessageQueue::cancel ( )

Sets that the queue is canceled.

◆ cancelAndNotify()

void ml::BackgroundTaskMessageQueue::cancelAndNotify ( )

Sets that the queue is canceled and notifies it if it is waiting for new messages.

◆ isCanceled()

bool ml::BackgroundTaskMessageQueue::isCanceled ( ) const
inline

Returns if the queue has been canceled.

Definition at line 69 of file mlBackgroundTaskMessageQueue.h.

◆ nextMessage() [1/2]

BackgroundTaskMessage * ml::BackgroundTaskMessageQueue::nextMessage ( )

Returns the next message without blocking, returns NULL if no message was available.

(the returned message is owned by the user and needs to be deleted by the user) (threadsafe)

◆ nextMessage() [2/2]

BackgroundTaskMessage * ml::BackgroundTaskMessageQueue::nextMessage ( int & availableMessages)

Returns the next message and the number of available messages (including the returned message) without blocking, returns NULL if no message was available.

(the returned message is owned by the user and needs to be deleted by the user) (threadsafe)

◆ nextMessageNoLock()

BackgroundTaskMessage * ml::BackgroundTaskMessageQueue::nextMessageNoLock ( )

Returns the next message without locking the queue (ONLY use for synchronous case!).

(the returned message is owned by the user and needs to be deleted by the user) (NOT threadsafe)

◆ removeMessagesForReceiver()

void ml::BackgroundTaskMessageQueue::removeMessagesForReceiver ( BackgroundTaskMessageReceiver * receiver)

Remove all messages for the given receiver.

(threadsafe)

◆ waitForMessage()

BackgroundTaskMessage * ml::BackgroundTaskMessageQueue::waitForMessage ( )

wait for the next message (the returned message is owned by the user and needs to be deleted by the user) the message can be NULL, when the task was canceled (should be only called in worker thread) (threadsafe)


The documentation for this class was generated from the following file: