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 <sys/errno.h> | 7 #include <sys/errno.h> |
8 | 8 |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 | 10 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 | 59 |
60 Thread::Thread(ThreadStartFunction function, uword parameter) { | 60 Thread::Thread(ThreadStartFunction function, uword parameter) { |
61 pthread_attr_t attr; | 61 pthread_attr_t attr; |
62 int result = pthread_attr_init(&attr); | 62 int result = pthread_attr_init(&attr); |
63 VALIDATE_PTHREAD_RESULT(result); | 63 VALIDATE_PTHREAD_RESULT(result); |
64 | 64 |
65 result = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); | 65 result = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); |
66 VALIDATE_PTHREAD_RESULT(result); | 66 VALIDATE_PTHREAD_RESULT(result); |
67 | 67 |
68 result = pthread_attr_setstacksize(&attr, 64 * KB); | 68 result = pthread_attr_setstacksize(&attr, 128 * KB); |
69 VALIDATE_PTHREAD_RESULT(result); | 69 VALIDATE_PTHREAD_RESULT(result); |
70 | 70 |
71 ThreadStartData* data = new ThreadStartData(function, parameter, this); | 71 ThreadStartData* data = new ThreadStartData(function, parameter, this); |
72 | 72 |
73 pthread_t tid; | 73 pthread_t tid; |
74 result = pthread_create(&tid, | 74 result = pthread_create(&tid, |
75 &attr, | 75 &attr, |
76 ThreadStart, | 76 ThreadStart, |
77 data); | 77 data); |
78 VALIDATE_PTHREAD_RESULT(result); | 78 VALIDATE_PTHREAD_RESULT(result); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 } | 220 } |
221 | 221 |
222 | 222 |
223 void Monitor::NotifyAll() { | 223 void Monitor::NotifyAll() { |
224 // TODO(iposva): Do we need to track lock owners? | 224 // TODO(iposva): Do we need to track lock owners? |
225 int result = pthread_cond_broadcast(data_.cond()); | 225 int result = pthread_cond_broadcast(data_.cond()); |
226 VALIDATE_PTHREAD_RESULT(result); | 226 VALIDATE_PTHREAD_RESULT(result); |
227 } | 227 } |
228 | 228 |
229 } // namespace dart | 229 } // namespace dart |
OLD | NEW |