| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 64 | 64 | 
| 65 | 65 | 
| 66 int Thread::Start(ThreadStartFunction function, uword parameter) { | 66 int Thread::Start(ThreadStartFunction function, uword parameter) { | 
| 67   pthread_attr_t attr; | 67   pthread_attr_t attr; | 
| 68   int result = pthread_attr_init(&attr); | 68   int result = pthread_attr_init(&attr); | 
| 69   RETURN_ON_PTHREAD_FAILURE(result); | 69   RETURN_ON_PTHREAD_FAILURE(result); | 
| 70 | 70 | 
| 71   result = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); | 71   result = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); | 
| 72   RETURN_ON_PTHREAD_FAILURE(result); | 72   RETURN_ON_PTHREAD_FAILURE(result); | 
| 73 | 73 | 
| 74 #ifdef DEBUG |  | 
| 75   const int kStackSize = (512 * KB); |  | 
| 76 #else |  | 
| 77   const int kStackSize = (128 * KB); | 74   const int kStackSize = (128 * KB); | 
| 78 #endif |  | 
| 79   result = pthread_attr_setstacksize(&attr, kStackSize); | 75   result = pthread_attr_setstacksize(&attr, kStackSize); | 
| 80   RETURN_ON_PTHREAD_FAILURE(result); | 76   RETURN_ON_PTHREAD_FAILURE(result); | 
| 81 | 77 | 
| 82   ThreadStartData* data = new ThreadStartData(function, parameter); | 78   ThreadStartData* data = new ThreadStartData(function, parameter); | 
| 83 | 79 | 
| 84   pthread_t tid; | 80   pthread_t tid; | 
| 85   result = pthread_create(&tid, &attr, ThreadStart, data); | 81   result = pthread_create(&tid, &attr, ThreadStart, data); | 
| 86   RETURN_ON_PTHREAD_FAILURE(result); | 82   RETURN_ON_PTHREAD_FAILURE(result); | 
| 87 | 83 | 
| 88   result = pthread_attr_destroy(&attr); | 84   result = pthread_attr_destroy(&attr); | 
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 250 } | 246 } | 
| 251 | 247 | 
| 252 | 248 | 
| 253 void Monitor::NotifyAll() { | 249 void Monitor::NotifyAll() { | 
| 254   // TODO(iposva): Do we need to track lock owners? | 250   // TODO(iposva): Do we need to track lock owners? | 
| 255   int result = pthread_cond_broadcast(data_.cond()); | 251   int result = pthread_cond_broadcast(data_.cond()); | 
| 256   VALIDATE_PTHREAD_RESULT(result); | 252   VALIDATE_PTHREAD_RESULT(result); | 
| 257 } | 253 } | 
| 258 | 254 | 
| 259 }  // namespace dart | 255 }  // namespace dart | 
| OLD | NEW | 
|---|