Question

I have a dll which has following functions: "initializing", "reset", "start recording", "cancel" etc,. Rarely the function "start recording" get's stuck and doesn't come out. In this case I need to activate the function "cancel" and the dll provider asked to run in separate thread to avoid this situation. I tried running two while loops in parallel but this didn't work. Any suggestion, references etc,.

Was it helpful?

Solution

This is a classic notifier approach. There are several options (the most basic one using an occurance): NotifierExample
In the init block you add your Initializing call. In the Start Recording you add the 'Start Recording' DLL call, use the error out to feed into the 'Wait on Notification' function, this makes sure the time-out start at the correct moment. If you detect that the measurement call is done you can use 'sent notification'.
If the 'Wait on Notification function times out you can use the output boolean timed out to instruct the case structure to send the 'Cancel' function.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top