OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2009 Google Inc. All rights reserved. | 3 * Copyright (C) 2009 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 bool killed() const; | 70 bool killed() const; |
71 | 71 |
72 // The result of isEmpty() is only valid if no other thread is manipulat
ing the queue at the same time. | 72 // The result of isEmpty() is only valid if no other thread is manipulat
ing the queue at the same time. |
73 bool isEmpty(); | 73 bool isEmpty(); |
74 | 74 |
75 static double infiniteTime() { return std::numeric_limits<double>::max()
; } | 75 static double infiniteTime() { return std::numeric_limits<double>::max()
; } |
76 | 76 |
77 private: | 77 private: |
78 mutable Mutex m_mutex; | 78 mutable Mutex m_mutex; |
79 ThreadCondition m_condition; | 79 ThreadCondition m_condition; |
80 Deque<OwnPtr<DataType> > m_queue; | 80 Deque<OwnPtr<DataType>> m_queue; |
81 bool m_killed; | 81 bool m_killed; |
82 }; | 82 }; |
83 | 83 |
84 template<typename DataType> | 84 template<typename DataType> |
85 inline bool MessageQueue<DataType>::append(PassOwnPtr<DataType> message) | 85 inline bool MessageQueue<DataType>::append(PassOwnPtr<DataType> message) |
86 { | 86 { |
87 MutexLocker lock(m_mutex); | 87 MutexLocker lock(m_mutex); |
88 m_queue.append(message); | 88 m_queue.append(message); |
89 m_condition.signal(); | 89 m_condition.signal(); |
90 return !m_killed; | 90 return !m_killed; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 } // namespace WTF | 202 } // namespace WTF |
203 | 203 |
204 using WTF::MessageQueue; | 204 using WTF::MessageQueue; |
205 // MessageQueueWaitResult enum and all its values. | 205 // MessageQueueWaitResult enum and all its values. |
206 using WTF::MessageQueueWaitResult; | 206 using WTF::MessageQueueWaitResult; |
207 using WTF::MessageQueueTerminated; | 207 using WTF::MessageQueueTerminated; |
208 using WTF::MessageQueueTimeout; | 208 using WTF::MessageQueueTimeout; |
209 using WTF::MessageQueueMessageReceived; | 209 using WTF::MessageQueueMessageReceived; |
210 | 210 |
211 #endif // MessageQueue_h | 211 #endif // MessageQueue_h |
OLD | NEW |