xref: /llvm-project/libc/src/pthread/pthread_attr_init.cpp (revision 5ff3ff33ff930e4ec49da7910612d8a41eb068cb)
10258f566SSiva Chandra Reddy //===-- Implementation of the pthread_attr_init ---------------------------===//
20258f566SSiva Chandra Reddy //
30258f566SSiva Chandra Reddy // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40258f566SSiva Chandra Reddy // See https://llvm.org/LICENSE.txt for license information.
50258f566SSiva Chandra Reddy // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60258f566SSiva Chandra Reddy //
70258f566SSiva Chandra Reddy //===----------------------------------------------------------------------===//
80258f566SSiva Chandra Reddy 
90258f566SSiva Chandra Reddy #include "pthread_attr_init.h"
100258f566SSiva Chandra Reddy 
110258f566SSiva Chandra Reddy #include "src/__support/common.h"
12*5ff3ff33SPetr Hosek #include "src/__support/macros/config.h"
136a185718SNoah Goldstein #include "src/__support/threads/thread.h" // For thread::DEFAULT_*
140258f566SSiva Chandra Reddy 
150258f566SSiva Chandra Reddy #include <pthread.h>
160258f566SSiva Chandra Reddy 
17*5ff3ff33SPetr Hosek namespace LIBC_NAMESPACE_DECL {
180258f566SSiva Chandra Reddy 
190258f566SSiva Chandra Reddy LLVM_LIBC_FUNCTION(int, pthread_attr_init, (pthread_attr_t * attr)) {
200258f566SSiva Chandra Reddy   *attr = pthread_attr_t{
216a185718SNoah Goldstein       PTHREAD_CREATE_JOINABLE,   // Not detached
220258f566SSiva Chandra Reddy       nullptr,                   // Let the thread manage its stack
236a185718SNoah Goldstein       Thread::DEFAULT_STACKSIZE, // stack size.
246a185718SNoah Goldstein       Thread::DEFAULT_GUARDSIZE, // Default page size for the guard size.
250258f566SSiva Chandra Reddy   };
260258f566SSiva Chandra Reddy   return 0;
270258f566SSiva Chandra Reddy }
280258f566SSiva Chandra Reddy 
29*5ff3ff33SPetr Hosek } // namespace LIBC_NAMESPACE_DECL
30