diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-02-02 12:48:17 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-02-02 12:48:17 +0000 |
commit | ec4178dd0ff7587b79a8c525aa88d467642ce629 (patch) | |
tree | 6db0317be3b6d5246786cfd222b0a2991f6b2d96 /src/chevents.c | |
parent | d1ea164bdb96503020d315cce14471c3e0d87c36 (diff) | |
download | ChibiOS-ec4178dd0ff7587b79a8c525aa88d467642ce629.tar.gz ChibiOS-ec4178dd0ff7587b79a8c525aa88d467642ce629.tar.bz2 ChibiOS-ec4178dd0ff7587b79a8c525aa88d467642ce629.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@712 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'src/chevents.c')
-rw-r--r-- | src/chevents.c | 45 |
1 files changed, 34 insertions, 11 deletions
diff --git a/src/chevents.c b/src/chevents.c index dc096767e..8391f3a0c 100644 --- a/src/chevents.c +++ b/src/chevents.c @@ -91,8 +91,8 @@ eventmask_t chEvtClear(eventmask_t mask) { }
/**
- * @brief Makes an events mask pending in the current thread, this is \b much
- * faster than using @p chEvtBroadcast().
+ * @brief Pends a set of event flags on the current thread, this is \b much
+ * faster than using @p chEvtBroadcast() or @p chEvtSignal().
*
* @param mask the events to be pended
* @return The current pending events mask.
@@ -108,6 +108,37 @@ eventmask_t chEvtPend(eventmask_t mask) { }
/**
+ * @brief Pends a set of event flags on the specified @p Thread.
+ *
+ * @param tp the thread to be signaled
+ * @param mask the event flags set to be pended
+ */
+void chEvtSignal(Thread *tp, eventmask_t mask) {
+
+ chSysLock();
+
+ chEvtSignalI(tp, mask);
+
+ chSysUnlock();
+}
+
+/**
+ * @brief Pends a set of event flags on the specified @p Thread.
+ *
+ * @param tp the thread to be signaled
+ * @param mask the event flags set to be pended
+ */
+void chEvtSignalI(Thread *tp, eventmask_t mask) {
+
+ tp->p_epending |= mask;
+
+ /* Test on the AND/OR conditions wait states.*/
+ if (((tp->p_state == PRWTOREVT) && ((tp->p_epending & tp->p_ewmask) != 0)) ||
+ ((tp->p_state == PRWTANDEVT) && ((tp->p_epending & tp->p_ewmask) == tp->p_ewmask)))
+ chSchReadyI(tp)->p_rdymsg = RDY_OK;
+}
+
+/**
* @brief Signals all the Event Listeners registered on the specified Event
* Source.
*
@@ -134,15 +165,7 @@ void chEvtBroadcastI(EventSource *esp) { elp = esp->es_next;
while (elp != (EventListener *)esp) {
- Thread *tp = elp->el_listener;
-
- tp->p_epending |= elp->el_mask;
-
- /* Test on the AND/OR conditions wait states.*/
- if (((tp->p_state == PRWTOREVT) && ((tp->p_epending & tp->p_ewmask) != 0)) ||
- ((tp->p_state == PRWTANDEVT) && ((tp->p_epending & tp->p_ewmask) == tp->p_ewmask)))
- chSchReadyI(tp)->p_rdymsg = RDY_OK;
-
+ chEvtSignalI(elp->el_listener, elp->el_mask);
elp = elp->el_next;
}
}
|