33 #ifndef _CTHREAD_SCHED_H_
34 #define _CTHREAD_SCHED_H_
51 if (sched == THIS_SCHED)
52 _cthread_queue_insert_sp((THIS_SCHED)->ready, ct);
54 _cthread_queue_insert_mp(sched->
pready, ct);
66 _ready_queue_remove(
struct cthread_queue *q)
68 return _cthread_queue_remove(q);
80 _ready_queue_empty(
struct cthread_queue *q)
82 return _cthread_queue_empty(q);
89 static inline uint64_t
94 if (now > (THIS_SCHED)->
birth)
95 return now - (THIS_SCHED)->
birth;
97 if (now < (THIS_SCHED)->birth)
98 return (THIS_SCHED)->birth - now;
104 static inline void __attribute__((always_inline)) _affinitize(
void)
106 struct cthread *ct = THIS_CTHREAD;
108 cthread_switch(&(THIS_SCHED)->
ctx, &ct->
ctx);
111 static inline void __attribute__((always_inline)) _suspend(
void)
113 struct cthread *ct = THIS_CTHREAD;
115 (THIS_SCHED)->nb_blocked_threads++;
116 cthread_switch(&(THIS_SCHED)->
ctx, &ct->
ctx);
117 (THIS_SCHED)->nb_blocked_threads--;
120 static inline void __attribute__((always_inline)) _reschedule(
void)
122 struct cthread *ct = THIS_CTHREAD;
124 _ready_queue_insert(THIS_SCHED, ct);
125 cthread_switch(&(THIS_SCHED)->
ctx, &ct->
ctx);
129 is_sched_running(
void)
136 void _sched_timer_cb(
struct cne_timer *tim,
void *arg);
137 void _sched_shutdown(
void *arg);
static uint64_t cne_rdtsc(void)
struct cthread_queue * pready