Skip to content

Commit

Permalink
lib: posix: add error code return
Browse files Browse the repository at this point in the history
Added return of ESRCH error code in
pthread_getschedparam() when the
specified thread could not be found.

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
  • Loading branch information
Niranjhana N authored and nashif committed Sep 28, 2018
1 parent ea716bf commit 482579e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/posix/pthread.c
Expand Up @@ -296,8 +296,14 @@ int pthread_attr_init(pthread_attr_t *attr)
int pthread_getschedparam(pthread_t pthread, int *policy,
struct sched_param *param)
{
k_tid_t thread = (k_tid_t)pthread;
u32_t priority = k_thread_priority_get(thread);
struct posix_thread *thread = (struct posix_thread *) pthread;
u32_t priority;

if (thread == NULL || thread->state == PTHREAD_TERMINATED) {
return ESRCH;
}

priority = k_thread_priority_get((k_tid_t) thread);

param->priority = zephyr_to_posix_priority(priority, policy);
return 0;
Expand Down

0 comments on commit 482579e

Please sign in to comment.