Skip to content

Commit 9fe8cfe

Browse files
committed
Insert at the head of RunQ, to execute timer first.
1 parent a789c98 commit 9fe8cfe

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ extern _st_eventsys_t *_st_eventsys;
299299
#define _ST_DEL_IOQ(_pq) ST_REMOVE_LINK(&_pq.links)
300300

301301
#define _ST_ADD_RUNQ(_thr) ST_APPEND_LINK(&(_thr)->links, &_ST_RUNQ)
302+
#define _ST_INSERT_RUNQ(_thr) ST_INSERT_LINK(&(_thr)->links, &_ST_RUNQ)
302303
#define _ST_DEL_RUNQ(_thr) ST_REMOVE_LINK(&(_thr)->links)
303304

304305
#define _ST_ADD_SLEEPQ(_thr, _timeout) _st_add_sleep_q(_thr, _timeout)

sched.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,8 @@ void _st_vp_check_clock(void)
548548
/* Make thread runnable */
549549
ST_ASSERT(!(thread->flags & _ST_FL_IDLE_THREAD));
550550
thread->state = _ST_ST_RUNNABLE;
551-
_ST_ADD_RUNQ(thread);
551+
// Insert at the head of RunQ, to execute timer first.
552+
_ST_INSERT_RUNQ(thread);
552553
}
553554
}
554555

0 commit comments

Comments
 (0)