Changeset 24522
- Timestamp:
- 03/22/08 10:36:20 (8 months ago)
- Location:
- haiku/trunk
- Files:
-
- 1 added
- 1 modified
-
docs/user/app/MessageQueue.dox (added)
-
src/kits/app/MessageQueue.cpp (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
haiku/trunk/src/kits/app/MessageQueue.cpp
r19956 r24522 26 26 27 27 28 /*!29 \brief This is the desctructor for the BMessageQueue. It iterates over30 any messages left on the queue and deletes them.31 32 The implementation is careful not to release the lock when the33 BMessageQueue is deconstructed. If the lock is released, it is34 possible another thread will start an AddMessage() operation before35 the BLocker is deleted. The safe thing to do is not to unlock the36 BLocker from the destructor once it is acquired. That way, any thread37 waiting to do a AddMessage() will fail to acquire the lock since the38 BLocker will be deleted before they can acquire it.39 */40 28 BMessageQueue::~BMessageQueue() 41 29 { … … 53 41 54 42 55 /*!56 \brief This method adds a BMessage to the queue.57 58 It makes a couple of assumptions:59 - The BMessage was allocated on the heap with new, since the60 destructor delete's BMessages left on the queue.61 - The BMessage is not already on this or any other BMessageQueue.62 If it is, the queue it is already on will be corrupted.63 */64 43 void 65 44 BMessageQueue::AddMessage(BMessage* message) … … 89 68 90 69 91 /*!92 \brief This method searches the queue for a particular BMessage.93 If it is found, it is removed from the queue.94 */95 70 void 96 71 BMessageQueue::RemoveMessage(BMessage* message) … … 123 98 124 99 125 /*!126 \brief This method just returns the number of BMessages on the queue.127 */128 100 int32 129 101 BMessageQueue::CountMessages() const … … 133 105 134 106 135 /*!136 \brief This method just returns true if there are no BMessages on the queue.137 */138 107 bool 139 108 BMessageQueue::IsEmpty() const … … 143 112 144 113 145 /*!146 \brief This method searches the queue for the index'th BMessage.147 148 The first BMessage is at index 0, the second at index 1 etc.149 The BMessage is returned if it is found. If no BMessage exists at that150 index (ie the queue is not that long or the index is invalid) NULL is151 returned.152 */153 114 BMessage * 154 115 BMessageQueue::FindMessage(int32 index) const … … 173 134 174 135 175 /*!176 \brief Searches the queue for the index'th BMessage that has a177 particular what code.178 */179 136 BMessage * 180 137 BMessageQueue::FindMessage(uint32 what, int32 index) const … … 201 158 202 159 203 /*!204 \brief Locks the BMessageQueue so no other thread can change205 or search the queue.206 */207 160 bool 208 161 BMessageQueue::Lock() … … 212 165 213 166 214 /*!215 \brief Releases the lock which was acquired by Lock().216 */217 167 void 218 168 BMessageQueue::Unlock() … … 222 172 223 173 224 /*!225 \brief Returns whether or not the queue is locked226 */227 174 bool 228 175 BMessageQueue::IsLocked() const … … 232 179 233 180 234 /*!235 \brief Removes the first BMessage on the queue and returns236 it to the caller. If the queue is empty, NULL is returned.237 */238 181 BMessage * 239 182 BMessageQueue::NextMessage() … … 263 206 264 207 265 /*!266 \brief Checks wether or not the specified \a message is the message267 you would get when calling NextMessage().268 */269 208 bool 270 209 BMessageQueue::IsNextMessage(const BMessage* message) const
