Phil Endecott wrote:
> You need thread cancellation. No, it's not in Boost.Thread, or in
> N2447. What platform are you using? But without cancellation, you're
> doing the right thing.
Right now, platform is WinXP, but I was looking forward to maybe migrate
to Linux eventually. I guess since what I'm doing works fine and you
agree with it, I'll keep it that way
> Why do you have to wait for the first thread to terminate before
> starting another one?
Well - matter of design as I migrated it from WideStudio, related to my
limited unterstanding of threads. I had a global variable pointing to my
thread (no real multithreading needed, just the network traffic handler
in parallel to the wxWidgets GUI event handler). So I was initializing
the thread once in my wxApp::OnInit, and then doing a thread::Execute
whenever the user told the software to start listening, and send that
end of stream signal when the user clicked the "Stop Listening" button.
I would need the global variable as a handle to restart the thread. If -
as you replied in the other post - I can just destroy the thread object
after initial start of thread of execution, I guess I don't really need
the global variable anymore anyways.
>> Since I know there's usually lots of brainpower and developed thoughts
>> behind such things, by people with far more experience than myself,
>> maybe someone knows what the reasoning behind this design was..
> What aspect of the design are you questioning?
That a thread cannot be restarted, but instead has to be destroyed and
reconstructed.
Best Regards,
Lars