1 // Copyright 2023 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 // Description: Common functions for NACL and all Linux and
5 // Linux-derivatives.
6
7 #include "base/threading/platform_thread.h"
8
9 namespace base {
10
GetDefaultThreadStackSize(const pthread_attr_t & attributes)11 size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) {
12 #if !defined(THREAD_SANITIZER) && defined(__GLIBC__)
13 // Generally glibc sets ample default stack sizes, so use the default there.
14 return 0;
15 #elif !defined(THREAD_SANITIZER)
16 // Other libcs (uclibc, musl, etc) tend to use smaller stacks, often too small
17 // for chromium. Make sure we have enough space to work with here. Note that
18 // for comparison glibc stacks are generally around 8MB.
19 return 2 * (1 << 20);
20 #else
21 // ThreadSanitizer bloats the stack heavily. Evidence has been that the
22 // default stack size isn't enough for some browser tests.
23 return 2 * (1 << 23); // 2 times 8192K (the default stack size on Linux).
24 #endif
25 }
26
InitThreading()27 void InitThreading() {}
28
TerminateOnThread()29 void TerminateOnThread() {}
30
31 } // namespace base