OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "platform/thread.h" | 5 #include "platform/thread.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <sys/time.h> | 8 #include <sys/time.h> |
9 | 9 |
10 #include "platform/assert.h" | 10 #include "platform/assert.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
204 result = pthread_mutex_init(data_.mutex(), &mutex_attr); | 204 result = pthread_mutex_init(data_.mutex(), &mutex_attr); |
205 VALIDATE_PTHREAD_RESULT(result); | 205 VALIDATE_PTHREAD_RESULT(result); |
206 | 206 |
207 result = pthread_mutexattr_destroy(&mutex_attr); | 207 result = pthread_mutexattr_destroy(&mutex_attr); |
208 VALIDATE_PTHREAD_RESULT(result); | 208 VALIDATE_PTHREAD_RESULT(result); |
209 | 209 |
210 pthread_condattr_t cond_attr; | 210 pthread_condattr_t cond_attr; |
211 result = pthread_condattr_init(&cond_attr); | 211 result = pthread_condattr_init(&cond_attr); |
212 VALIDATE_PTHREAD_RESULT(result); | 212 VALIDATE_PTHREAD_RESULT(result); |
213 | 213 |
214 #if 0 | |
215 // This API is not available on Android. | |
cshapiro
2012/08/07 20:56:54
It is, but only through the non-standard name pth
jackpal
2012/08/07 21:43:26
Done.
| |
214 result = pthread_condattr_setclock(&cond_attr, CLOCK_MONOTONIC); | 216 result = pthread_condattr_setclock(&cond_attr, CLOCK_MONOTONIC); |
215 VALIDATE_PTHREAD_RESULT(result); | 217 VALIDATE_PTHREAD_RESULT(result); |
218 #endif | |
216 | 219 |
217 result = pthread_cond_init(data_.cond(), &cond_attr); | 220 result = pthread_cond_init(data_.cond(), &cond_attr); |
218 VALIDATE_PTHREAD_RESULT(result); | 221 VALIDATE_PTHREAD_RESULT(result); |
219 | 222 |
220 result = pthread_condattr_destroy(&cond_attr); | 223 result = pthread_condattr_destroy(&cond_attr); |
221 VALIDATE_PTHREAD_RESULT(result); | 224 VALIDATE_PTHREAD_RESULT(result); |
222 } | 225 } |
223 | 226 |
224 | 227 |
225 Monitor::~Monitor() { | 228 Monitor::~Monitor() { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
272 } | 275 } |
273 | 276 |
274 | 277 |
275 void Monitor::NotifyAll() { | 278 void Monitor::NotifyAll() { |
276 // TODO(iposva): Do we need to track lock owners? | 279 // TODO(iposva): Do we need to track lock owners? |
277 int result = pthread_cond_broadcast(data_.cond()); | 280 int result = pthread_cond_broadcast(data_.cond()); |
278 VALIDATE_PTHREAD_RESULT(result); | 281 VALIDATE_PTHREAD_RESULT(result); |
279 } | 282 } |
280 | 283 |
281 } // namespace dart | 284 } // namespace dart |
OLD | NEW |