aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/chevents.c6
-rw-r--r--src/chschd.c2
-rw-r--r--src/chsem.c11
3 files changed, 7 insertions, 12 deletions
diff --git a/src/chevents.c b/src/chevents.c
index 72ca7c182..9fd2e4543 100644
--- a/src/chevents.c
+++ b/src/chevents.c
@@ -53,9 +53,9 @@ void chEvtRegister(EventSource *esp, EventListener *elp, t_eventid eid) {
* @param elp pointer to the \p EventListener structure
* @note If the event listener is not registered on the specified event source
* then the function does nothing.
- * @note For optimal performance perform the unregister operations in inverse
- * order of the register operations (elements are found on top of the
- * list).
+ * @note For optimal performance it is better to perform the unregister
+ * operations in inverse order of the register operations (elements are
+ * found on top of the list).
*/
void chEvtUnregister(EventSource *esp, EventListener *elp) {
EventListener *p = (EventListener *)esp;
diff --git a/src/chschd.c b/src/chschd.c
index 92a0fbb0d..1242ea275 100644
--- a/src/chschd.c
+++ b/src/chschd.c
@@ -90,6 +90,7 @@ void chSchGoSleepS(t_tstate newstate) {
chSysSwitchI(otp, currp);
}
+#ifdef CH_USE_VIRTUAL_TIMERS
static void wakeup(void *p) {
if (((Thread *)p)->p_state == PRWTSEM)
@@ -116,6 +117,7 @@ t_msg chSchGoSleepTimeoutS(t_tstate newstate, t_time time) {
chVTResetI(&vt);
return currp->p_rdymsg;
}
+#endif /* CH_USE_VIRTUAL_TIMERS */
/**
* Wakeups a thread, the thread is inserted into the ready list or made
diff --git a/src/chsem.c b/src/chsem.c
index ceaa64399..edec3b5db 100644
--- a/src/chsem.c
+++ b/src/chsem.c
@@ -47,18 +47,11 @@ void chSemInit(Semaphore *sp, t_cnt n) {
* \p RDY_RESET.
*/
void chSemReset(Semaphore *sp, t_cnt n) {
- t_cnt cnt;
- chDbgAssert(n >= 0, "chsem.c, chSemReset()");
chSysLock();
- cnt = sp->s_cnt;
- sp->s_cnt = n;
- if (cnt < 0) {
- while (cnt++)
- chSchReadyI(fifo_remove(&sp->s_queue), RDY_RESET);
- chSchRescheduleS();
- }
+ chSemResetI(sp, n);
+ chSchRescheduleS();
chSysUnlock();
}