Skip to content

Commit 5ad7f4b

Browse files
ycsincarlescufi
authored andcommitted
posix: pthread: priority should be of int type
Changed the variable type of the priority in the args and the return type of the conversion functions to `int`, as both Zephyr's priority & POSIX's `sched_priority` has type `int`. Signed-off-by: Yong Cong Sin <[email protected]>
1 parent b2caec8 commit 5ad7f4b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/posix/pthread.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ static bool is_posix_policy_prio_valid(uint32_t priority, int policy)
227227
return false;
228228
}
229229

230-
static uint32_t zephyr_to_posix_priority(int32_t z_prio, int *policy)
230+
static int zephyr_to_posix_priority(int z_prio, int *policy)
231231
{
232232
if (z_prio < 0) {
233233
__ASSERT_NO_MSG(-z_prio <= CONFIG_NUM_COOP_PRIORITIES);
@@ -239,7 +239,7 @@ static uint32_t zephyr_to_posix_priority(int32_t z_prio, int *policy)
239239
return ZEPHYR_TO_POSIX_PRIORITY(z_prio);
240240
}
241241

242-
static int32_t posix_to_zephyr_priority(uint32_t priority, int policy)
242+
static int posix_to_zephyr_priority(int priority, int policy)
243243
{
244244
if (policy == SCHED_FIFO) {
245245
/* COOP: highest [-CONFIG_NUM_COOP_PRIORITIES, -1] lowest */
@@ -701,7 +701,7 @@ int pthread_attr_init(pthread_attr_t *_attr)
701701
*/
702702
int pthread_getschedparam(pthread_t pthread, int *policy, struct sched_param *param)
703703
{
704-
uint32_t priority;
704+
int priority;
705705
struct posix_thread *t;
706706

707707
t = to_posix_thread(pthread);

0 commit comments

Comments
 (0)