Thread exits immediately with no reason.
Ali Çehreli
acehreli at yahoo.com
Tue Dec 21 01:13:10 UTC 2021
On 12/20/21 3:56 PM, solidstate1991 wrote:
> The problem is, that even with disabling all error-handling that would
> allow to shut down the thread safely, the thread only runs that while
> loop once.
I bet it's throwing an Error. Call your thread entry function from a
try-catch wrapping function to see whether that's the case:
// Rename existing function:
protected void audioThreadImpl() @nogc nothrow {
// ...
}
// New function
protected void audioThread() @nogc nothrow {
try {
audioThreadImpl();
} catch (Error err) {
stderr.writefln!"ERROR: %s"(err);
}
}
That should print a call stack. You can catch Throwable instead of Error
but with nothrow, it's guaranteed that it's not an Exception.
Note: nothrow means "does not throw Exception". Errors can still be thrown.
Ali
More information about the Digitalmars-d-learn
mailing list