Can anyone share design strategies for dealing with exceptions thrown in threads? Or rather, how to throw exceptions in threads?
For context, I'm working on a handler that has a collection of objects that require data from an external REST interface. The objects each run a set of processing phases. I've found that I see a significant speedup when this processing phases are chained and run inside a thread.
I've written a primitive thread scheduler that orchestrates the thread lifecycle.The scheduler calls ->execute() which in turn increments an internal 'pointer' within the object to the next processing phase. Effectively, the scheduler calls execute() in an iterative fashion until it returns false. When the scheduler sees false, it assumes the thread has completed it's work. In between execution phases I'd like to surface any unrecoverable application errors. Is this something I need to implement myself? It seems naive to implement my own internal error collection and poll it before each execution phase. My assumption is there is a much better way to do this.
I've been googling around but I haven't found much information on ngx threads outside the spawn() and wait() documentation. If anyone has any design pointers, criticism, or helpful links I'd really appreciate it. This is somewhat new territory for me.