vfs: check userland buffers before reading them.
[haiku.git] / src / servers / registrar / PriorityMessageQueue.h
blob50f1fc6a9b297c5d14811d1ae7c242a341c087e0
1 //----------------------------------------------------------------------
2 // This software is part of the OpenBeOS distribution and is covered
3 // by the MIT License.
4 //---------------------------------------------------------------------
6 #ifndef PRIORITY_MESSAGE_QUEUE_H
7 #define PRIORITY_MESSAGE_QUEUE_H
9 #include <Locker.h>
10 #include <ObjectList.h>
12 class BMessage;
14 class PriorityMessageQueue {
15 public:
16 PriorityMessageQueue();
17 ~PriorityMessageQueue();
19 bool Lock();
20 void Unlock();
22 bool PushMessage(BMessage *message, int32 priority = 0);
23 BMessage *PopMessage();
25 int32 CountMessages() const;
26 bool IsEmpty() const;
28 private:
29 int32 _FindInsertionIndex(int32 priority);
31 private:
32 class MessageInfo;
34 private:
35 mutable BLocker fLock;
36 BObjectList<MessageInfo> fMessages;
39 #endif // PRIORITY_MESSAGE_QUEUE_H