aboutsummaryrefslogtreecommitdiffstats
path: root/examples/performance-thread/common/lthread_sched.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/performance-thread/common/lthread_sched.c')
-rw-r--r--examples/performance-thread/common/lthread_sched.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/examples/performance-thread/common/lthread_sched.c b/examples/performance-thread/common/lthread_sched.c
index c64c21ff..fbda112f 100644
--- a/examples/performance-thread/common/lthread_sched.c
+++ b/examples/performance-thread/common/lthread_sched.c
@@ -562,11 +562,14 @@ void lthread_run(void)
* Return the scheduler for this lcore
*
*/
-struct lthread_sched *_lthread_sched_get(int lcore_id)
+struct lthread_sched *_lthread_sched_get(unsigned int lcore_id)
{
- if (lcore_id > LTHREAD_MAX_LCORES)
- return NULL;
- return schedcore[lcore_id];
+ struct lthread_sched *res = NULL;
+
+ if (lcore_id < LTHREAD_MAX_LCORES)
+ res = schedcore[lcore_id];
+
+ return res;
}
/*
@@ -578,10 +581,9 @@ int lthread_set_affinity(unsigned lcoreid)
struct lthread *lt = THIS_LTHREAD;
struct lthread_sched *dest_sched;
- if (unlikely(lcoreid > LTHREAD_MAX_LCORES))
+ if (unlikely(lcoreid >= LTHREAD_MAX_LCORES))
return POSIX_ERRNO(EINVAL);
-
DIAG_EVENT(lt, LT_DIAG_LTHREAD_AFFINITY, lcoreid, 0);
dest_sched = schedcore[lcoreid];