how to force single thread instructions on a generator node


What would be the best way to force a process to run single threaded (not sharing or accessing resources).
I’m currently working with the ANN library and need to lock some functionality on one thread.

I have tried incorporating critical sections but as soon as it enters the critical sections world machine crashes.
Any suggestions? Would there maybe be a WM function set availble that would let me access or lock threads?

Any help would be greatly appreciated!

Just figured out it’s better to use Mutex… sorry about that!

Critical sections should work just fine – I’m not sure why they’re crashing but as long as you have initialized them in the object constructor and cleanup at destruction you should have no issues!

I want to call a MFC application inside of a win32 thread. The MFC application has now been compiled into a static library, and it works if its not in a seperate thread, but if I call AfxWinMain in a seperate thread it fails on pThread->InitInstance inside of AfxWinMain, any ideas?

как начать интернет бизнес консультации