First big PITA in reallife D project

FeepingCreature default_357-line at yahoo.de
Tue Oct 19 09:07:04 PDT 2010


On 19.10.2010 13:33, Stephan wrote:
> BUT it wont work like that. AFTER i stopped all other threads some
> strange behavior of druntime makes every creation of an InternetAddress
> instance (internally trying to resolve host) impossible (throws an
> exception). Additionally even if the Internet Addresses were created
> upfront the TcpSockets wont connect but throw.

Terminating threads has always been iffy in D. As a simple workaround, use a threadpool to keep a set of threads around blocking on a semaphore (and consuming no resources), and rewrite your problem in terms of tasks (void delegate()).

I'm sorry you had such a bad experience with this. There really should be a list of common D pitfalls, and "Don't ever destroy threads" should be among the top ten.


More information about the Digitalmars-d mailing list