MeVisLab Toolbox Reference
|
#include <mlBackgroundTaskMessageQueue.h>
Public Member Functions | |
BackgroundTaskMessageQueue () | |
~BackgroundTaskMessageQueue () | |
BackgroundTaskMessage * | waitForMessage () |
Waits for the next message. More... | |
void | addMessage (BackgroundTaskMessage *message) |
Puts the message in the queue and passes ownership to the queue Do not delete the message! This is thread-safe. More... | |
BackgroundTaskMessage * | nextMessage () |
Returns the next message without blocking and returns NULL if no message was available. More... | |
BackgroundTaskMessage * | nextMessage (int &availableMessages) |
Returns the next message and the number of available messages, including the returned message, without blocking. More... | |
BackgroundTaskMessage * | nextMessageNoLock () |
Returns the next message without locking the queue. More... | |
void | removeMessagesForReceiver (BackgroundTaskMessageReceiver *receiver) |
Removes all messages for the given receiver. More... | |
bool | isCanceled () const |
Returns whether the queue has been canceled. More... | |
void | cancel () |
Sets that the queue is canceled. More... | |
void | cancelAndNotify () |
Sets that the queue is canceled and notifies it if it is waiting for new messages. More... | |
Definition at line 32 of file mlBackgroundTaskMessageQueue.h.
ml::BackgroundTaskMessageQueue::BackgroundTaskMessageQueue | ( | ) |
ml::BackgroundTaskMessageQueue::~BackgroundTaskMessageQueue | ( | ) |
void ml::BackgroundTaskMessageQueue::addMessage | ( | BackgroundTaskMessage * | message | ) |
Puts the message in the queue and passes ownership to the queue Do not delete the message! This is thread-safe.
void ml::BackgroundTaskMessageQueue::cancel | ( | ) |
Sets that the queue is canceled.
void ml::BackgroundTaskMessageQueue::cancelAndNotify | ( | ) |
Sets that the queue is canceled and notifies it if it is waiting for new messages.
|
inline |
Returns whether the queue has been canceled.
Definition at line 73 of file mlBackgroundTaskMessageQueue.h.
BackgroundTaskMessage* ml::BackgroundTaskMessageQueue::nextMessage | ( | ) |
Returns the next message without blocking and returns NULL if no message was available.
The returned message is owned by the user and needs to be deleted by the user. This is thread-safe.
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. This is thread-safe.
BackgroundTaskMessage* ml::BackgroundTaskMessageQueue::nextMessageNoLock | ( | ) |
Returns the next message without locking the queue.
Use it only for synchronous mode! The returned message is owned by the user and needs to be deleted by the user. This is not thread-safe.
void ml::BackgroundTaskMessageQueue::removeMessagesForReceiver | ( | BackgroundTaskMessageReceiver * | receiver | ) |
Removes all messages for the given receiver.
This is thread-safe.
BackgroundTaskMessage* ml::BackgroundTaskMessageQueue::waitForMessage | ( | ) |
Waits 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. This should only be called in a worker thread. This is thread-safe.