Hey Y'all,
NOTE: Putting this here since I was only able to test this on Linux(Ubuntu 23.04 64b).
I'm exploring all the possibilities of threads since I have a project that will heavily rely on them.
In order to do that I've been following the
Multithreaded Application Tutorial entry on the wiki.
One of the
See Also links mentioned is the
Manager Worker Threads System.
I downloaded the archived files from Source Forge:
Manager Worker Thread Example.
Attached is the same example with some alterations:
- Added an event to log stuff on the main forms ( Not using it since I needed to use WriteLn to debug the Destroy parts )
- Corrected a small bug that would only add one worker thread to the pool.
Now, here's the problem:
When the application ends, it tries to
Terminate->
WaitFor->
FreeAndNil each of the created worker threads.
That's expected and it should be ok for all the created threads!! ( In the example I use a queue of 3 )
But in my Linux environment, it will do that for
Worker 0, but then it will get stuck on the
WaitFor of
Worker 1 forever.
Since all 3 workers are created equal and they don't differ in anything obvious that I can see, I'm completely baffled and in need of help from the community!!
Many thanks in advance!!
Cheers,
Gus