@@ -332,16 +332,22 @@ void k_thread_foreach_unlocked_filter_by_cpu(unsigned int cpu,
332
332
/**
333
333
* @brief Dynamically allocate a thread stack.
334
334
*
335
+ * Dynamically allocate a thread stack either from a pool of thread stacks of size
336
+ * @kconfig{CONFIG_DYNAMIC_THREAD_POOL_SIZE}, or from the system heap. Order is determined by the
337
+ * kconfig{CONFIG_DYNAMIC_THREAD_PREFER_ALLOC} and @kconfig{CONFIG_DYNAMIC_THREAD_PREFER_POOL}
338
+ * options. Thread stacks from the pool are of maximum size
339
+ * @kconfig{CONFIG_DYNAMIC_THREAD_STACK_SIZE}.
340
+ *
335
341
* Relevant stack creation flags include:
336
- * - @ref K_USER allocate a userspace thread (requires ` CONFIG_USERSPACE=y` )
342
+ * - @ref K_USER allocate a userspace thread (requires @kconfig{ CONFIG_USERSPACE} )
337
343
*
338
344
* @param size Stack size in bytes.
339
345
* @param flags Stack creation flags, or 0.
340
346
*
341
347
* @retval the allocated thread stack on success.
342
348
* @retval NULL on failure.
343
349
*
344
- * @see CONFIG_DYNAMIC_THREAD
350
+ * @see @kconfig{ CONFIG_DYNAMIC_THREAD}
345
351
*/
346
352
__syscall k_thread_stack_t * k_thread_stack_alloc (size_t size , int flags );
347
353
@@ -355,7 +361,7 @@ __syscall k_thread_stack_t *k_thread_stack_alloc(size_t size, int flags);
355
361
* @retval -EINVAL if @p stack is invalid.
356
362
* @retval -ENOSYS if dynamic thread stack allocation is disabled
357
363
*
358
- * @see CONFIG_DYNAMIC_THREAD
364
+ * @see @kconfig{ CONFIG_DYNAMIC_THREAD}
359
365
*/
360
366
__syscall int k_thread_stack_free (k_thread_stack_t * stack );
361
367
@@ -373,7 +379,7 @@ __syscall int k_thread_stack_free(k_thread_stack_t *stack);
373
379
* K_FP_REGS, and K_SSE_REGS. Multiple options may be specified by separating
374
380
* them using "|" (the logical OR operator).
375
381
*
376
- * Stack objects passed to this function must be originally defined with
382
+ * Stack objects passed to this function may be statically allocated with
377
383
* either of these macros in order to be portable:
378
384
*
379
385
* - K_THREAD_STACK_DEFINE() - For stacks that may support either user or
@@ -382,6 +388,10 @@ __syscall int k_thread_stack_free(k_thread_stack_t *stack);
382
388
* threads only. These stacks use less memory if CONFIG_USERSPACE is
383
389
* enabled.
384
390
*
391
+ * Alternatively, the stack may be dynamically allocated using
392
+ * @ref k_thread_stack_alloc. If this is the case, then the stack should
393
+ * be freed using @ref k_thread_stack_free after joining the thread.
394
+ *
385
395
* The stack_size parameter has constraints. It must either be:
386
396
*
387
397
* - The original size value passed to K_THREAD_STACK_DEFINE() or
0 commit comments