@@ -20,10 +20,13 @@ const pthread_attr_t pthread_default_attr =
2020{
2121 0 , /* stack base */
2222 DEFAULT_STACK_SIZE , /* stack size */
23- DEFAULT_PRIORITY , /* priority */
24- PTHREAD_CREATE_JOINABLE , /* detach state */
23+
24+ PTHREAD_INHERIT_SCHED , /* Inherit parent prio/policy */
2525 SCHED_FIFO , /* scheduler policy */
26- PTHREAD_INHERIT_SCHED /* Inherit parent prio/policy */
26+ {
27+ DEFAULT_PRIORITY , /* scheduler priority */
28+ },
29+ PTHREAD_CREATE_JOINABLE , /* detach state */
2730};
2831
2932int pthread_attr_init (pthread_attr_t * attr )
@@ -73,7 +76,7 @@ int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy)
7376{
7477 RT_ASSERT (attr != RT_NULL );
7578
76- attr -> policy = policy ;
79+ attr -> schedpolicy = policy ;
7780
7881 return 0 ;
7982}
@@ -83,7 +86,7 @@ int pthread_attr_getschedpolicy(pthread_attr_t const *attr, int *policy)
8386{
8487 RT_ASSERT (attr != RT_NULL );
8588
86- * policy = (int )attr -> policy ;
89+ * policy = (int )attr -> schedpolicy ;
8790
8891 return 0 ;
8992}
@@ -95,7 +98,7 @@ int pthread_attr_setschedparam(pthread_attr_t *attr,
9598 RT_ASSERT (attr != RT_NULL );
9699 RT_ASSERT (param != RT_NULL );
97100
98- attr -> priority = param -> sched_priority ;
101+ attr -> schedparam . sched_priority = param -> sched_priority ;
99102
100103 return 0 ;
101104}
@@ -107,7 +110,7 @@ int pthread_attr_getschedparam(pthread_attr_t const *attr,
107110 RT_ASSERT (attr != RT_NULL );
108111 RT_ASSERT (param != RT_NULL );
109112
110- param -> sched_priority = attr -> priority ;
113+ param -> sched_priority = attr -> schedparam . sched_priority ;
111114
112115 return 0 ;
113116}
@@ -117,7 +120,7 @@ int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stack_size)
117120{
118121 RT_ASSERT (attr != RT_NULL );
119122
120- attr -> stack_size = stack_size ;
123+ attr -> stacksize = stack_size ;
121124
122125 return 0 ;
123126}
@@ -127,7 +130,7 @@ int pthread_attr_getstacksize(pthread_attr_t const *attr, size_t *stack_size)
127130{
128131 RT_ASSERT (attr != RT_NULL );
129132
130- * stack_size = attr -> stack_size ;
133+ * stack_size = attr -> stacksize ;
131134
132135 return 0 ;
133136}
@@ -155,8 +158,8 @@ int pthread_attr_setstack(pthread_attr_t *attr,
155158{
156159 RT_ASSERT (attr != RT_NULL );
157160
158- attr -> stack_base = stack_base ;
159- attr -> stack_size = RT_ALIGN_DOWN (stack_size , RT_ALIGN_SIZE );
161+ attr -> stackaddr = stack_base ;
162+ attr -> stacksize = RT_ALIGN_DOWN (stack_size , RT_ALIGN_SIZE );
160163
161164 return 0 ;
162165}
@@ -168,8 +171,8 @@ int pthread_attr_getstack(pthread_attr_t const *attr,
168171{
169172 RT_ASSERT (attr != RT_NULL );
170173
171- * stack_base = attr -> stack_base ;
172- * stack_size = attr -> stack_size ;
174+ * stack_base = attr -> stackaddr ;
175+ * stack_size = attr -> stacksize ;
173176
174177 return 0 ;
175178}
0 commit comments