Suggestions to handle touch events efficiently?

I am about to implement some touching events and I was wondering if EventListenerTouchOneByOne is efficient enough to queue itself up for the case that touching is faster than the code i want to execute at ::onTouchEnded().

If not, I plan to implement std::queue and store touch actions, and then deal with this during update,
while(!vector.isEmpty()){
if (touch){
shortCode();
} else {
longCode();
}

So going back to the question, if i implement longCode() and onTouchEnd(), but player makes another touch before longCode() ends, would EventListenerTouchOneByOne queue up this touch automatically?

Are you asking to allow for both a quick touch as well as long press? Do you want to detect double tap? What’s your use case?

no, im talking about the scenario of every time a user touch the screen, 20 sprites moves around, ex.

move() {
//bunch of calcualtions
//bunch of draw
//bunch of motion
//bunch of code
}

if i put this code at:
onTouchEnded(Touch * touch, …){
move(); \LINE A
}

and during the execution of method move() at line A, the user touches the screen again, would this new touch be automatically queued to run until the current code in move() finish ?

Ah I see. Touches should queue up and call onTouchEnded (and other events) in the order they were received. They queue up according on iOS according to the link below. And I would presume the same on Android and likely other platforms as most if not all have an event driven queue. The best advice I can think of is to test it out because I wouldn’t be surprised if there were issues with a touch handler that takes more processing time than the input is being received and responded to.

https://developer.apple.com/library/ios/documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/event_delivery_responder_chain/event_delivery_responder_chain.html#//apple_ref/doc/uid/TP40009541-CH4-SW2