Thread exits immediately with no reason.

solidstate1991 laszloszeremi at outlook.com
Tue Dec 21 18:07:28 UTC 2021


On Tuesday, 21 December 2021 at 01:13:10 UTC, Ali Çehreli wrote:
> 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

I couldn't add those lines unfortunately, but I do get an 
exception in a destructor at line 218 of `wasapi.d`. It's access 
violation executing a location.


More information about the Digitalmars-d-learn mailing list