Package org.smtlib
Class SolverProcess.StreamGobbler
java.lang.Object
java.lang.Thread
org.smtlib.SolverProcess.StreamGobbler
- All Implemented Interfaces:
Runnable
- Enclosing class:
SolverProcess
Continuously drains one of the process's output streams (stdout or stderr) on a
dedicated thread, so that a solver writing a large amount of text to one stream
can never be blocked by the other stream's OS pipe buffer filling up while this
process is busy reading elsewhere -- reading stdout and stderr sequentially in a
single thread cannot make that guarantee.
Complete chunks of text are handed off to the consumer through a BlockingQueue,
which is what supplies the actual thread-safety here: only this thread ever touches
the in-progress StringBuilder, and only complete, immutable Strings cross to another
thread, via a queue implementation that already provides the necessary locking and
visibility guarantees. No manual synchronized/wait/notify is needed.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
ConstructorsConstructorDescriptionStreamGobbler(InputStream is, Function<StringBuilder, Boolean> endRecognizer, Charset charset) -
Method Summary
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, toString, yield
-
Constructor Details
-
StreamGobbler
public StreamGobbler(InputStream is, Function<StringBuilder, Boolean> endRecognizer, Charset charset)
-
-
Method Details