File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 24
24
25
25
#include <nuttx/config.h>
26
26
27
+ #include <nuttx/irq.h>
27
28
#include <pthread.h>
28
29
#include <semaphore.h>
29
- #include <sched.h>
30
30
#include <errno.h>
31
31
#include <debug.h>
32
32
@@ -82,6 +82,7 @@ int pthread_barrier_wait(FAR pthread_barrier_t *barrier)
82
82
{
83
83
int semcount ;
84
84
int ret = OK ;
85
+ irqstate_t flags ;
85
86
86
87
if (!barrier )
87
88
{
@@ -90,14 +91,14 @@ int pthread_barrier_wait(FAR pthread_barrier_t *barrier)
90
91
91
92
/* Disable pre-emption throughout the following */
92
93
93
- sched_lock ();
94
+ flags = enter_critical_section ();
94
95
95
96
/* Find out how many threads are already waiting at the barrier */
96
97
97
98
ret = sem_getvalue (& barrier -> sem , & semcount );
98
99
if (ret != OK )
99
100
{
100
- sched_unlock ( );
101
+ leave_critical_section ( flags );
101
102
return get_errno ();
102
103
}
103
104
@@ -115,7 +116,7 @@ int pthread_barrier_wait(FAR pthread_barrier_t *barrier)
115
116
116
117
/* Then return PTHREAD_BARRIER_SERIAL_THREAD to the final thread */
117
118
118
- sched_unlock ( );
119
+ leave_critical_section ( flags );
119
120
return PTHREAD_BARRIER_SERIAL_THREAD ;
120
121
}
121
122
else
@@ -133,7 +134,7 @@ int pthread_barrier_wait(FAR pthread_barrier_t *barrier)
133
134
* problem
134
135
*/
135
136
136
- sched_unlock ( );
137
+ leave_critical_section ( flags );
137
138
return errornumber ;
138
139
}
139
140
}
@@ -143,7 +144,7 @@ int pthread_barrier_wait(FAR pthread_barrier_t *barrier)
143
144
* zero.
144
145
*/
145
146
146
- sched_unlock ( );
147
+ leave_critical_section ( flags );
147
148
return 0 ;
148
149
}
149
150
}
You can’t perform that action at this time.
0 commit comments