Description
When unparsing with the SAX API, we spawn a new thread and run the unparse() call in that using our custom coroutine implementation. The main SAX thread and the coroutine unparse thread() using an ArrayBlockingQueue to suspend execution of one subroutine while the other executes.
However, if the main thread throws an exception then it leaves the corutine unparse() thread hung, blocked on the ArrayBlockingQueue.
This is exactly what happens if there is mixed content in the infoset we are unparsing. If mixed content is detected in the DaffodilUnparseContentHander startElement function then, then we throw an exception that can be caught by the SAX API, but the unparse thread is still running and blocked.
One option is to modify the startElement() function in the main thread to add state to a SAXEvent when it detects mixed content. When the unparse thread sees this state it can cause the unparse() thread to finish by throwing an exception. This will create an UnparseResult that eventually is passed back to the main thread and coroutine logic can finish.