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/globals.h" | 5 #include "platform/globals.h" |
6 #if defined(TARGET_OS_LINUX) | 6 #if defined(TARGET_OS_LINUX) |
7 | 7 |
8 #include "platform/thread.h" | 8 #include "platform/thread.h" |
9 | 9 |
10 #include <errno.h> // NOLINT | 10 #include <errno.h> // NOLINT |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 ASSERT(result == 0); | 48 ASSERT(result == 0); |
49 ts->tv_sec += secs; | 49 ts->tv_sec += secs; |
50 ts->tv_nsec += nanos; | 50 ts->tv_nsec += nanos; |
51 if (ts->tv_nsec >= kNanosecondsPerSecond) { | 51 if (ts->tv_nsec >= kNanosecondsPerSecond) { |
52 ts->tv_sec += 1; | 52 ts->tv_sec += 1; |
53 ts->tv_nsec -= kNanosecondsPerSecond; | 53 ts->tv_nsec -= kNanosecondsPerSecond; |
54 } | 54 } |
55 } | 55 } |
56 | 56 |
57 | 57 |
58 static void ComputeTimeSpec(struct timespec* ts, int64_t millis) { | |
59 ComputeTimeSpec(ts, millis * kMicrosecondsPerMillisecond); | |
60 } | |
61 | |
62 | |
63 class ThreadStartData { | 58 class ThreadStartData { |
64 public: | 59 public: |
65 ThreadStartData(Thread::ThreadStartFunction function, | 60 ThreadStartData(Thread::ThreadStartFunction function, |
66 uword parameter) | 61 uword parameter) |
67 : function_(function), parameter_(parameter) {} | 62 : function_(function), parameter_(parameter) {} |
68 | 63 |
69 Thread::ThreadStartFunction function() const { return function_; } | 64 Thread::ThreadStartFunction function() const { return function_; } |
70 uword parameter() const { return parameter_; } | 65 uword parameter() const { return parameter_; } |
71 | 66 |
72 private: | 67 private: |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 | 305 |
311 void Monitor::NotifyAll() { | 306 void Monitor::NotifyAll() { |
312 // TODO(iposva): Do we need to track lock owners? | 307 // TODO(iposva): Do we need to track lock owners? |
313 int result = pthread_cond_broadcast(data_.cond()); | 308 int result = pthread_cond_broadcast(data_.cond()); |
314 VALIDATE_PTHREAD_RESULT(result); | 309 VALIDATE_PTHREAD_RESULT(result); |
315 } | 310 } |
316 | 311 |
317 } // namespace dart | 312 } // namespace dart |
318 | 313 |
319 #endif // defined(TARGET_OS_LINUX) | 314 #endif // defined(TARGET_OS_LINUX) |
OLD | NEW |