Re: Thread exits immediately with no reason.

2021-12-21 Thread solidstate1991 via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 19:00:01 UTC, solidstate1991 wrote: Well, it seems like it's an error on the WASAPI side. I totally disabled error handling (including the switch-case thingy), then GetBuffer returns with an error code indicating buffer is too large. The solution was to call

Re: Thread exits immediately with no reason.

2021-12-21 Thread solidstate1991 via Digitalmars-d-learn
Well, it seems like it's an error on the WASAPI side. I totally disabled error handling (including the switch-case thingy), then GetBuffer returns with an error code indicating buffer is too large.

Re: Thread exits immediately with no reason.

2021-12-21 Thread Ali Çehreli via Digitalmars-d-learn
On 12/21/21 10:07 AM, solidstate1991 wrote: > I couldn't add those lines unfortunately, Perhaps I had typos? Or the code is not yours to modify? In any case, you should be able to introduce a top level thread entry function and put the try-catch in there. > but I do get an exception in a >

Re: Thread exits immediately with no reason.

2021-12-21 Thread solidstate1991 via Digitalmars-d-learn
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

Re: Thread exits immediately with no reason.

2021-12-21 Thread Dennis via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 07:08:53 UTC, bauss wrote: It should at the very least warn people about functions that may throw errors. What is "It"? I was looking to make a spec PR, but it already says here: https://dlang.org/spec/function.html#nothrow-functions Nothrow functions can

Re: Thread exits immediately with no reason.

2021-12-20 Thread bauss via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 01:13:10 UTC, Ali Çehreli wrote: Note: nothrow means "does not throw Exception". Errors can still be thrown. Ali Which sort of makes sense since they're in theory "unrecoverable", but the name is sort of misleading because of this minor detail. It should

Re: Thread exits immediately with no reason.

2021-12-20 Thread Ali Çehreli via Digitalmars-d-learn
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

Thread exits immediately with no reason.

2021-12-20 Thread solidstate1991 via Digitalmars-d-learn
Here's this function, which serves as a thread entry point: https://github.com/ZILtoid1991/iota/blob/main/source/iota/audio/wasapi.d#L220 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.