Examples in the code of starting a worker thread from a console command?
by Demolishun · in Torque 3D Professional · 08/21/2012 (10:20 pm) · 3 replies
I am getting side tracked a bit as I want to understand how to start a thread to do some work. I am going through the source files about threading, but am unsure how to make a simple thread pool or worker thread.
Do I need to go through a thread manager?
Can I just launch a thread?
I think what I want to do is have the console commands run and submit worker threads and exit. Then the console and main engine will be freed up to continue doing what they were doing. In the meantime the worker threads execute in sequence to perform the actions needed. So it would be a stack of worker threads performing unique tasks. The reason they would stack is because they are operating on the same data.
Another issue with this is I would need to make sure the engine itself does not access the object the threads are operating on. Since it is a SimObject this could be messy.
I can design it so the actual object operated on is a bitmap instead. That would protect the data a bit since it is not readily inside of a SimObject.
Do I need to go through a thread manager?
Can I just launch a thread?
I think what I want to do is have the console commands run and submit worker threads and exit. Then the console and main engine will be freed up to continue doing what they were doing. In the meantime the worker threads execute in sequence to perform the actions needed. So it would be a stack of worker threads performing unique tasks. The reason they would stack is because they are operating on the same data.
Another issue with this is I would need to make sure the engine itself does not access the object the threads are operating on. Since it is a SimObject this could be messy.
I can design it so the actual object operated on is a bitmap instead. That would protect the data a bit since it is not readily inside of a SimObject.
About the author
I love programming, I love programming things that go click, whirr, boom. For organized T3D Links visit: http://demolishun.com/?page_id=67
#2
08/22/2012 (6:00 am)
Great resource on just this. It doesn't go into much detail, but lays out the basics of using threads to do stuff.
#3
08/22/2012 (7:20 am)
Guy and dB strike again! Thanks
Torque Owner Guy Allard
Default Studio Name