On Tue, 19 Oct 2010 12:07:04 -0400, FeepingCreature
<[email protected]> wrote:
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.
This one was a simple bug. He was not terminating threads, rather he was
letting a thread exit normally.
-Steve