public void addCommand(String newCommand) { // Queue the event and return so as to not block the calling thread. // The event will be picked up by handleNewCommand() and added to a queue. // This approach eliminates the need to mutex the command queue, // because all queue manipulation occurs on the state machine thread. // It is not always necesary to copy an event before it is queued. // However, in this case, multiple copies of the event can be queued, // with each event carrying a unique data payload. // Also note that event is being tagged as "deleteAfterHandling," that // lets the framework know to delete this copy once processing is complete. queueEvent(newCommandEvent.copy(newCommand)); }
private void state1_1EntryAction(NSFStateMachineContext context) { ++currentEventCount; if ((currentEventCount % numberOfRepeatedEvents) == 0) { NSFDebugUtility.PrimaryDebugUtility.writeToConsole("."); event1.queueEvent(); event3.queueEvent(); event4.copy().queueEvent(); event2.schedule(50, 0); } else { event1.queueEvent(); event5.queueEvent(); event6.copy().queueEvent(); event2.schedule(50, 0); } }
public void addResponse(String newResponse) { // Queue the event and return so as to not block the calling thread. queueEvent(newResponseEvent.copy(newResponse)); }