Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(704)

Side by Side Diff: platform/thread_linux.cc

Issue 10544170: Have the stack overflow code use the correct stack size set by the platform/thread.h (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « platform/thread.h ('k') | platform/thread_macos.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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, 64 * KB); 90 result = pthread_attr_setstacksize(&attr, Thread::GetMaxStackSize());
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 21 matching lines...) Expand all
122 } 122 }
123 123
124 124
125 void Thread::SetThreadLocal(ThreadLocalKey key, uword value) { 125 void Thread::SetThreadLocal(ThreadLocalKey key, uword value) {
126 ASSERT(key != kUnsetThreadLocalKey); 126 ASSERT(key != kUnsetThreadLocalKey);
127 int result = pthread_setspecific(key, reinterpret_cast<void*>(value)); 127 int result = pthread_setspecific(key, reinterpret_cast<void*>(value));
128 VALIDATE_PTHREAD_RESULT(result); 128 VALIDATE_PTHREAD_RESULT(result);
129 } 129 }
130 130
131 131
132 intptr_t Thread::GetMaxStackSize() {
133 const int kStackSize = (256 * KB);
134 return kStackSize;
135 }
136
137
132 Mutex::Mutex() { 138 Mutex::Mutex() {
133 pthread_mutexattr_t attr; 139 pthread_mutexattr_t attr;
134 int result = pthread_mutexattr_init(&attr); 140 int result = pthread_mutexattr_init(&attr);
135 VALIDATE_PTHREAD_RESULT(result); 141 VALIDATE_PTHREAD_RESULT(result);
136 142
137 #if defined(DEBUG) 143 #if defined(DEBUG)
138 result = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK); 144 result = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);
139 VALIDATE_PTHREAD_RESULT(result); 145 VALIDATE_PTHREAD_RESULT(result);
140 #endif // defined(DEBUG) 146 #endif // defined(DEBUG)
141 147
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 } 272 }
267 273
268 274
269 void Monitor::NotifyAll() { 275 void Monitor::NotifyAll() {
270 // TODO(iposva): Do we need to track lock owners? 276 // TODO(iposva): Do we need to track lock owners?
271 int result = pthread_cond_broadcast(data_.cond()); 277 int result = pthread_cond_broadcast(data_.cond());
272 VALIDATE_PTHREAD_RESULT(result); 278 VALIDATE_PTHREAD_RESULT(result);
273 } 279 }
274 280
275 } // namespace dart 281 } // namespace dart
OLDNEW
« no previous file with comments | « platform/thread.h ('k') | platform/thread_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698