Author Topic: how to force single thread instructions on a generator node  (Read 2635 times)

0 Members and 1 Guest are viewing this topic.

CKlosters

  • World Machine Veteran
  • ***
  • Posts: 20
    • View Profile
how to force single thread instructions on a generator node
« on: September 28, 2011, 04:38:16 AM »
Hi,

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!







CKlosters

  • World Machine Veteran
  • ***
  • Posts: 20
    • View Profile
Re: how to force single thread instructions on a generator node
« Reply #1 on: September 28, 2011, 06:37:18 AM »
Just figured out it's better to use Mutex...  sorry about that!


Remnant

  • Author
  • World Machine Guru
  • *****
  • Posts: 2311
    • View Profile
    • http://www.world-machine.com/
Re: how to force single thread instructions on a generator node
« Reply #2 on: September 28, 2011, 10:18:00 AM »
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!

-- Stephen Schmitt
- Creator of World Machine