haiku/src/servers/registrar/PriorityMessageQueue.h
Ingo Weinhold fadf867232 A priority message queue. We will use it to handle system notifications faster than client requests.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2642 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-02-06 23:31:45 +00:00

40 lines
829 B
C++

//----------------------------------------------------------------------
// This software is part of the OpenBeOS distribution and is covered
// by the OpenBeOS license.
//---------------------------------------------------------------------
#ifndef PRIORITY_MESSAGE_QUEUE_H
#define PRIORITY_MESSAGE_QUEUE_H
#include <Locker.h>
#include <ObjectList.h>
class BMessage;
class PriorityMessageQueue {
public:
PriorityMessageQueue();
~PriorityMessageQueue();
bool Lock();
void Unlock();
bool PushMessage(BMessage *message, int32 priority = 0);
BMessage *PopMessage();
int32 CountMessages() const;
bool IsEmpty() const;
private:
int32 _FindInsertionIndex(int32 priority);
private:
class MessageInfo;
private:
mutable BLocker fLock;
BObjectList<MessageInfo> fMessages;
};
#endif // PRIORITY_MESSAGE_QUEUE_H