G
gargoyle
I'm using ActivePerl 5.8.6.811 and have a question regarding threads.
What are the implications of starting a thread from within another (as
opposed to starting all threads from the main thread, ie. tid 0)? Will
any nasty bugs or strange issues come to bite me? In other words, was
the ithreads model written to handle this sort of behavior?
The reason I'm asking is because I'm trying to find a way to keep memory
footprint to a minimum, and yet be able to spawn new threads at any
given time. I figured a "dispatcher" thread could be started as early
as possible (before most modules are loaded, data structures filled,
etc.) and then when a new worker thread is needed, main could signal the
dispatcher (via a queue) and tell it to create a new thread with some
specific parameters (based on the job that needs to be accomplished at
that given moment).
Will this work, or is it just some crazy fantasy?
What are the implications of starting a thread from within another (as
opposed to starting all threads from the main thread, ie. tid 0)? Will
any nasty bugs or strange issues come to bite me? In other words, was
the ithreads model written to handle this sort of behavior?
The reason I'm asking is because I'm trying to find a way to keep memory
footprint to a minimum, and yet be able to spawn new threads at any
given time. I figured a "dispatcher" thread could be started as early
as possible (before most modules are loaded, data structures filled,
etc.) and then when a new worker thread is needed, main could signal the
dispatcher (via a queue) and tell it to create a new thread with some
specific parameters (based on the job that needs to be accomplished at
that given moment).
Will this work, or is it just some crazy fantasy?