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:

  1. expose function named (eg) stoprecording sets global variable inside native code
  2. 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

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -