| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 | 81 |
| 82 int Thread::Start(ThreadStartFunction function, uword parameter) { | 82 int Thread::Start(ThreadStartFunction function, uword parameter) { |
| 83 pthread_attr_t attr; | 83 pthread_attr_t attr; |
| 84 int result = pthread_attr_init(&attr); | 84 int result = pthread_attr_init(&attr); |
| 85 RETURN_ON_PTHREAD_FAILURE(result); | 85 RETURN_ON_PTHREAD_FAILURE(result); |
| 86 | 86 |
| 87 result = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); | 87 result = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); |
| 88 RETURN_ON_PTHREAD_FAILURE(result); | 88 RETURN_ON_PTHREAD_FAILURE(result); |
| 89 | 89 |
| 90 result = pthread_attr_setstacksize(&attr, 1024 * KB); | 90 result = pthread_attr_setstacksize(&attr, 64 * KB); |
| 91 RETURN_ON_PTHREAD_FAILURE(result); | 91 RETURN_ON_PTHREAD_FAILURE(result); |
| 92 | 92 |
| 93 ThreadStartData* data = new ThreadStartData(function, parameter); | 93 ThreadStartData* data = new ThreadStartData(function, parameter); |
| 94 | 94 |
| 95 pthread_t tid; | 95 pthread_t tid; |
| 96 result = pthread_create(&tid, &attr, ThreadStart, data); | 96 result = pthread_create(&tid, &attr, ThreadStart, data); |
| 97 RETURN_ON_PTHREAD_FAILURE(result); | 97 RETURN_ON_PTHREAD_FAILURE(result); |
| 98 | 98 |
| 99 result = pthread_attr_destroy(&attr); | 99 result = pthread_attr_destroy(&attr); |
| 100 RETURN_ON_PTHREAD_FAILURE(result); | 100 RETURN_ON_PTHREAD_FAILURE(result); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 } | 266 } |
| 267 | 267 |
| 268 | 268 |
| 269 void Monitor::NotifyAll() { | 269 void Monitor::NotifyAll() { |
| 270 // TODO(iposva): Do we need to track lock owners? | 270 // TODO(iposva): Do we need to track lock owners? |
| 271 int result = pthread_cond_broadcast(data_.cond()); | 271 int result = pthread_cond_broadcast(data_.cond()); |
| 272 VALIDATE_PTHREAD_RESULT(result); | 272 VALIDATE_PTHREAD_RESULT(result); |
| 273 } | 273 } |
| 274 | 274 |
| 275 } // namespace dart | 275 } // namespace dart |
| OLD | NEW |