www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Threads documentation.

I'm working on little threaded server and I've got lot of problems and
questions. Can somebody point me some more info how to use threads safety
and efficiently?

I've got some questions that I can ask right now:

1. Should all threads other than main be ended before main() ends? I've read
it somewhere and I've got impression that it's true.

2. Why std.Thread does not have a destructor? Destructor could close thread
and resolve problem 1. Of course if shutting down would 

3. How can I stop thread. I mean ... kill it ones and for good. If my main
listening thread is listening than I've got no way to shut it down before
new connection occur and it's loop checks it should be ended.

4. Should I explicitly delete Thread instances or not. Are there any advices
for memory management? Deleting should be done only after thread has ended?

5. Why I've got SIGUSR1 segfault? I think it's related to 1. but am I right?
If yes maybe somebody point me methods for controlling "server threads" -
threads that are listening for connections.

Regards,
-- 
Dawid Ciężarkiewicz | arael
jid: arael fov.pl
Feb 03 2005