Ok. In case the disconnect occurs before invoking the run_block function, the run_block function will return an error.
But, in case the disconnect occurs after calling of run_block function and before the trigger event, we will never leave the while loop as in example below.
printf ( "Waiting for trigger..." );
Sleep ( 100 );
Any idea how to handle this?