In the newer QP/C++, the QMActive::defer() operation does not assert. Instead it returns a bool (true if the event could be deferred and false otherwise). Please see the doxygen documentation at:
So, you no longer need to test the deferred-queue.
As to the while loop while recalling events in the entry action, I don't get it and it makes little sense to me. It seems to me that you just flood your primary queue with all the recalled events, which you then defer again.
--MMS
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The problem is not the size of the deferred queue, it's the size of the SM queue storage.
the SM schema is attached
I'll give you a quick example:
let's imagine a machine that send SMS.
This machine will have 3 states :
-Wait
-SmsRx
-SmsTx
And 2 signal :
-SMS_SEND_SIG : ask the machine to send a sms, the text, phone number are passed in the events
-SMS_RECEIVE_SIG : tell the machine that a sms has been received.
The initial state is, obviously the "Wait" state. On SMS_RECEIVE_SIG, the machine will transit to "SmsRx" where it will parse and treat the SMS. If, in this state I receive a "SMS_SEND_SIG", I don't want to loose the sms, so I defer the event and I will recall it in "Wait" state. The solution that you give the Psicc for this pattern works if I receive 1 "SMS_SEND_SIG" in the "SmsRx" state. It doesn"t work if I receive multiple signal.
But maybe I misunderstood the concept of defer/recall ?
The queue size of the active object (AO) is an issue only if you flood it with events. That's why I questioned your recalling all events at once in a tight while loop. This is a departure from the "Deferred Event" pattern, because events should be recalled one at a time.
I still don't understand your case for recalling all events at once. Perhaps you could elaborate why it is necessary and what it is that you are trying to achieve here.
--MMS
Last edit: Quantum Leaps 2015-06-26
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I'm using defer/recall concept, and it's really not critical if recall cannot be done because queue of the machine is full. Here is the code I use.
Busy state of a potential sm
And the state that recall event, maybe the while is not the best way..
I repeat that my interest here is to not assert when the queue storage of the machine (not the qequeue) is full.
Last edit: Rémi Desgrange 2015-06-25
In the newer QP/C++, the QMActive::defer() operation does not assert. Instead it returns a
bool
(true if the event could be deferred and false otherwise). Please see the doxygen documentation at:http://www.state-machine.com/qpcpp/class_q_p_1_1_q_m_active.html#a46fbfef403b1ee47ae4b30c709fb4021
So, you no longer need to test the deferred-queue.
As to the
while
loop while recalling events in the entry action, I don't get it and it makes little sense to me. It seems to me that you just flood your primary queue with all the recalled events, which you then defer again.--MMS
The problem is not the size of the deferred queue, it's the size of the SM queue storage.
the SM schema is attached
I'll give you a quick example:
let's imagine a machine that send SMS.
This machine will have 3 states :
-Wait
-SmsRx
-SmsTx
And 2 signal :
-SMS_SEND_SIG : ask the machine to send a sms, the text, phone number are passed in the events
-SMS_RECEIVE_SIG : tell the machine that a sms has been received.
The initial state is, obviously the "Wait" state. On SMS_RECEIVE_SIG, the machine will transit to "SmsRx" where it will parse and treat the SMS. If, in this state I receive a "SMS_SEND_SIG", I don't want to loose the sms, so I defer the event and I will recall it in "Wait" state. The solution that you give the Psicc for this pattern works if I receive 1 "SMS_SEND_SIG" in the "SmsRx" state. It doesn"t work if I receive multiple signal.
But maybe I misunderstood the concept of defer/recall ?
Last edit: Rémi Desgrange 2015-06-26
The queue size of the active object (AO) is an issue only if you flood it with events. That's why I questioned your recalling all events at once in a tight
while
loop. This is a departure from the "Deferred Event" pattern, because events should be recalled one at a time.I still don't understand your case for recalling all events at once. Perhaps you could elaborate why it is necessary and what it is that you are trying to achieve here.
--MMS
Last edit: Quantum Leaps 2015-06-26
I did see your post, I edit my response
Here is the schema