OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com) | 3 * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com) |
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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 132 |
133 class WTF_EXPORT ThreadCondition final { | 133 class WTF_EXPORT ThreadCondition final { |
134 USING_FAST_MALLOC(ThreadCondition); // Only HeapTest.cpp requires. | 134 USING_FAST_MALLOC(ThreadCondition); // Only HeapTest.cpp requires. |
135 WTF_MAKE_NONCOPYABLE(ThreadCondition); | 135 WTF_MAKE_NONCOPYABLE(ThreadCondition); |
136 | 136 |
137 public: | 137 public: |
138 ThreadCondition(); | 138 ThreadCondition(); |
139 ~ThreadCondition(); | 139 ~ThreadCondition(); |
140 | 140 |
141 void wait(MutexBase&); | 141 void wait(MutexBase&); |
142 // Returns true if the condition was signaled before absoluteTime, false if th
e absoluteTime was reached or is in the past. | 142 // Returns true if the condition was signaled before absoluteTime, false if |
143 // The absoluteTime is in seconds, starting on January 1, 1970. The time is as
sumed to use the same time zone as WTF::currentTime(). | 143 // the absoluteTime was reached or is in the past. |
| 144 // The absoluteTime is in seconds, starting on January 1, 1970. The time is |
| 145 // assumed to use the same time zone as WTF::currentTime(). |
144 bool timedWait(MutexBase&, double absoluteTime); | 146 bool timedWait(MutexBase&, double absoluteTime); |
145 void signal(); | 147 void signal(); |
146 void broadcast(); | 148 void broadcast(); |
147 | 149 |
148 private: | 150 private: |
149 PlatformCondition m_condition; | 151 PlatformCondition m_condition; |
150 }; | 152 }; |
151 | 153 |
152 #if OS(WIN) | 154 #if OS(WIN) |
153 // The absoluteTime is in seconds, starting on January 1, 1970. The time is assu
med to use the same time zone as WTF::currentTime(). | 155 // The absoluteTime is in seconds, starting on January 1, 1970. The time is |
154 // Returns an interval in milliseconds suitable for passing to one of the Win32
wait functions (e.g., ::WaitForSingleObject). | 156 // assumed to use the same time zone as WTF::currentTime(). |
| 157 // Returns an interval in milliseconds suitable for passing to one of the Win32 |
| 158 // wait functions (e.g., ::WaitForSingleObject). |
155 DWORD absoluteTimeToWaitTimeoutInterval(double absoluteTime); | 159 DWORD absoluteTimeToWaitTimeoutInterval(double absoluteTime); |
156 #endif | 160 #endif |
157 | 161 |
158 } // namespace WTF | 162 } // namespace WTF |
159 | 163 |
160 using WTF::MutexBase; | 164 using WTF::MutexBase; |
161 using WTF::Mutex; | 165 using WTF::Mutex; |
162 using WTF::RecursiveMutex; | 166 using WTF::RecursiveMutex; |
163 using WTF::MutexLocker; | 167 using WTF::MutexLocker; |
164 using WTF::MutexTryLocker; | 168 using WTF::MutexTryLocker; |
165 using WTF::ThreadCondition; | 169 using WTF::ThreadCondition; |
166 | 170 |
167 #if OS(WIN) | 171 #if OS(WIN) |
168 using WTF::absoluteTimeToWaitTimeoutInterval; | 172 using WTF::absoluteTimeToWaitTimeoutInterval; |
169 #endif | 173 #endif |
170 | 174 |
171 #endif // ThreadingPrimitives_h | 175 #endif // ThreadingPrimitives_h |
OLD | NEW |