1 /***************************************************************************
2  * Copyright (c) 2024 Microsoft Corporation
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the MIT License which is available at
6  * https://opensource.org/licenses/MIT.
7  *
8  * SPDX-License-Identifier: MIT
9  **************************************************************************/
10 
11 
12 /**************************************************************************/
13 /**************************************************************************/
14 /**                                                                       */
15 /** POSIX wrapper for THREADX                                             */
16 /**                                                                       */
17 /**                                                                       */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 
22 /* Include necessary system files.  */
23 
24 #include "tx_api.h"    /* Threadx API */
25 #include "pthread.h"  /* Posix API */
26 #include "px_int.h"    /* Posix helper functions */
27 
28 /**************************************************************************/
29 /*                                                                        */
30 /*  FUNCTION                                               RELEASE        */
31 /*                                                                        */
32 /*    set_default_pthread_attr                            PORTABLE C      */
33 /*                                                           6.1.7        */
34 /*  AUTHOR                                                                */
35 /*                                                                        */
36 /*    William E. Lamie, Microsoft Corporation                             */
37 /*                                                                        */
38 /*  DESCRIPTION                                                           */
39 /*                                                                        */
40 /*    This function sets default pthread attr w/ default information.     */
41 /*                                                                        */
42 /*  INPUT                                                                 */
43 /*                                                                        */
44 /*    attr                                  pthread attr object pointer   */
45 /*                                                                        */
46 /*  OUTPUT                                                                */
47 /*                                                                        */
48 /*    None                                                                */
49 /*                                                                        */
50 /*  CALLS                                                                 */
51 /*                                                                        */
52 /*    None                                                                */
53 /*                                                                        */
54 /*  CALLED BY                                                             */
55 /*                                                                        */
56 /*    Start-up code                                                       */
57 /*                                                                        */
58 /*  RELEASE HISTORY                                                       */
59 /*                                                                        */
60 /*    DATE              NAME                      DESCRIPTION             */
61 /*                                                                        */
62 /*  06-02-2021     William E. Lamie         Initial Version 6.1.7         */
63 /*                                                                        */
64 /**************************************************************************/
set_default_pthread_attr(pthread_attr_t * attr)65 VOID set_default_pthread_attr(pthread_attr_t *attr)
66 {
67     attr->detach_state =PTHREAD_CREATE_JOINABLE;
68     attr->inherit_sched =0;
69     attr->inuse =TX_TRUE;
70     attr->pthread_flags =0;
71     attr->sched_attr.sched_priority =31;
72     attr->sched_policy =0;
73     attr->stack_address =0;
74     attr->stack_size = TX_DEFAULT_THREAD_STACK_SIZE;
75 }
76