@@ -69,7 +69,9 @@ NotifierMsg<MsgType>* Notifier<MsgType>::acquireMsg(systime_t timeout){
6969}
7070
7171template <class MsgType >
72- msg_t Notifier<MsgType>::broadcastMsg(NotifierMsg<MsgType>* msg){
72+ msg_t Notifier<MsgType>::broadcastMsg(NotifierMsg<MsgType>* msg,
73+ systime_t timeout){
74+
7375
7476 msg_t errorState = RDY_OK;
7577
@@ -79,13 +81,15 @@ msg_t Notifier<MsgType>::broadcastMsg(NotifierMsg<MsgType>* msg){
7981 Listener<MsgType>* listener = n->get ();
8082
8183 chSysLock ();
82- msg_t err = chMBPostI (&listener->mailbox , (msg_t ) msg);
8384
84- if (err == RDY_OK){
85+ msg_t rdymsg = chMBPostS (&listener->mailbox , (msg_t ) msg, timeout);
86+
87+ if (rdymsg == RDY_OK){
8588 msg->usedCntr ++;
8689 } else {
8790 errorState = RDY_RESET;
8891 }
92+
8993 chSysUnlock ()
9094
9195 }
@@ -95,13 +99,13 @@ msg_t Notifier<MsgType>::broadcastMsg(NotifierMsg<MsgType>* msg){
9599}
96100
97101template <class MsgType >
98- msg_t Notifier<MsgType>::broadcast(const MsgType& msg){
102+ msg_t Notifier<MsgType>::broadcast(const MsgType& msg, systime_t timeout ){
99103
100104 // If there is no listener -> skip all the stuff
101105 if (listenersList.empty ())
102106 return RDY_OK;
103107
104- NotifierMsg<MsgType>* msgCopy = acquireMsg (TIME_IMMEDIATE );
108+ NotifierMsg<MsgType>* msgCopy = acquireMsg (timeout );
105109
106110 // Out of pool memory
107111 if (!msgCopy)
@@ -110,7 +114,7 @@ msg_t Notifier<MsgType>::broadcast(const MsgType& msg){
110114 // Assign message to new copy of object
111115 msgCopy->msg = msg;
112116
113- return broadcastMsg (msgCopy);
117+ return broadcastMsg (msgCopy, timeout );
114118
115119}
116120
0 commit comments