Starting and managing threads

Bagomot bagomot at gmail.com
Mon Dec 27 09:33:38 UTC 2021


Hello everybody!

My program uses the fswatch library to track changes in a 
directory. It runs on the main thread of the program. I need it 
to do its work in a separate thread, without blocking the main 
one. In addition, I need to be able to terminate the thread at 
the moment I want from the main thread of the program.

I tried to get my head around Thread and Fiber but still didn't 
figure out how to properly start and manage threads. I have using 
Thread turns it into a zombie when the main thread of the program 
ends.

I will not even write my code here, because it is at the level of 
examples from the documentation. Please tell me how to start 
threads correctly, how to manage them and how to end them without 
turning them into zombies.


More information about the Digitalmars-d-learn mailing list