Nxlib function isn't responding?

Hi Daniel

First, thanks a lot for your quick response!

The interval for hardware triggers cannot be specified.
Therefore, I consulted this community previously

(Aborting a capture command waiting for a trigger),
and after some back-and-forth, I arrived at this code.

Is there a way to keep the while loop as is and collect logs that will help identify the cause?

Currently, the Retrieve command has a timeout value of -1. What is the difference between this and specifying 0?

The while loop within doCapture() in the code I initially posted is actually processed as follows in the actual code:

while(1){
	if (retrieve.finished()) {
		bool rc2 = retrieve.result()[m_serial][itmRetrieved].asBool();
		if (rc2) {
			break;
		}
	}
	if(cancel_Button_ON()){
		retrieve.cancel();
		while (true) {
			if (retrieve.finished()) {
				return(1);
			}
		}
	}
}

The goal is to react to hardware triggers as quickly as possible and to exit the while loop waiting for finish() at the desired timing.

Could you please give me some advice on the above?

Best regards,
K.N,