1# Copyright (c) 2017 Intel Corporation
2# Copyright (c) 2023 Meta
3#
4# SPDX-License-Identifier: Apache-2.0
5
6TYPE = PTHREAD
7type = pthread_t
8type-function = pthread_create
9rsource "Kconfig.template.pooled_ipc_type"
10
11if PTHREAD
12
13config PTHREAD_RECYCLER_DELAY_MS
14	int "Delay for reclaiming dynamic pthread stacks (ms)"
15	default 100
16	help
17	  Prior to a POSIX thread terminating via k_thread_abort(), scheduled
18	  work is added to the system workqueue (SWQ) so that any resources
19	  allocated by the thread (e.g. thread stack from a pool or the heap)
20	  can be released back to the system. Because resources are also freed
21	  on calls to pthread_create() there is no need to worry about resource
22	  starvation.
23
24	  This option sets the number of milliseconds by which to defer
25	  scheduled work.
26
27	  Note: this option should be considered temporary and will likely be
28	  removed once a more synchronous solution is available.
29
30config POSIX_PTHREAD_ATTR_STACKSIZE_BITS
31	int "Significant bits for pthread_attr_t stacksize"
32	range 8 31
33	default 23
34	help
35	  This value plays a part in determining the maximum supported
36	  pthread_attr_t stacksize. Valid stacksizes are in the range
37	  [1, N], where N = 1 << M, and M is this configuration value.
38
39config POSIX_PTHREAD_ATTR_GUARDSIZE_BITS
40	int "Significant bits for pthread_attr_t guardsize"
41	range 1 31
42	default 9
43	help
44	  This value plays a part in determining the maximum supported
45	  pthread_attr_t guardsize. Valid guardsizes are in the range
46	  [0, N-1], where N = 1 << M, and M is this configuration value.
47
48	  Actual guardsize values may be rounded-up.
49
50config POSIX_PTHREAD_ATTR_GUARDSIZE_DEFAULT
51	int "Default size of stack guard area"
52	default 0
53	help
54	  This is the default amount of space to reserve at the overflow end of a
55	  pthread stack. Since Zephyr already supports both software-based stack
56	  protection (canaries) and hardware-based stack protection (MMU or MPU),
57	  this is set to 0 by default. However, a conforming application would be
58	  required to set this to PAGESIZE. Eventually, this option might
59	  facilitate a more dynamic approach to guard areas (via software or
60	  hardware) but for now it simply increases the size of thread stacks.
61
62endif
63