How to Terminate a C++ Function Called form C# Using p/invoke -
i calling c++ function c# using p/invoke, function has infinite loop (capturing frames file) should broken when event happened in c#.
how can break loop (which terminates function)?
i tried run function in thread in c#, , abort thread when termination needed. but abort function didn't work.
thread thread = new thread(mymethod); thread.start(); // terminate function thread.abort(); //didn't respond
probably safest way 2 things:
- expose function named (eg)
stoprecording
sets global variable inside native code - inside main function, check value of global @ start of every loop iteration see if
stoprecording
has been called (and if so, break out of loop)
this lets terminate naturally without requiring heavy-handed terminations.
Comments
Post a Comment