is there a way to implement such a communication in C++?
use case:
my main program calls a function of my external library to process a list. every time the function iterates through the list it sends a ping to the caller. the latter uses the received signal to track progress of the former and sends back a boolean pong [true: okay, move on; false: the user wants to abort the process, return now].
will this be more efficient than iterating through the list in the main program and let the function only process a single item? or the whole idea is just crap?
If it is the whole list you are processing, why not just use a return value from the function call to indicate when the iteration is complete. If you want to continue, call the function again – if not, dont.