Qore Programming Language Reference Manual
1.7.0
|
This class defines the API for single thread streams. More...
Public Member Methods | |
constructor () | |
Throws an exception if called directly; this class can only be instantiated by builtin subclasses. More... | |
int | getThreadId () |
Get the currently assigned thread id or -1 if not assigned to any thread. | |
nothing | reassignThread () |
Reassigns current thread as thread used for stream manipulation. More... | |
nothing | unassignThread () |
Unassigns current thread as thread used for stream manipulation. More... | |
This class defines the API for single thread streams.
Base class for stream classes which are not designed to be accessed from multiple threads; they have been implemented without locking for fast and efficient use when used from a single thread. For methods that would be unsafe to use in another thread, any use of such methods in threads other than the thread where the constructor was called will cause a STREAM-THREAD-ERROR
to be thrown, unless the stream is handed off to another thread using the StreamBase::unassignThread() method in the thread that currently owns the stream, and the StreamBase::reassignThread() method in the new thread.
Qore::StreamBase::constructor | ( | ) |
Throws an exception if called directly; this class can only be instantiated by builtin subclasses.
STREAMBASE-CONSTRUCTOR-ERROR | this exception is thrown if this class is constructed directly (also if directly inherited by user classes) |
nothing Qore::StreamBase::reassignThread | ( | ) |
Reassigns current thread as thread used for stream manipulation.
This method must be called from the new thread after calling the StreamBase::unassignThread() method in the thread that currently owns the stream
STREAM-THREAD-ERROR | thrown if called when the stream is assigned to another thread |
nothing Qore::StreamBase::unassignThread | ( | ) |
Unassigns current thread as thread used for stream manipulation.
This method must be called in the current thread that owns the stream before calling the StreamBase::reassignThread() method in the new thread
STREAM-THREAD-ERROR | thrown if called when the stream is assigned to another thread |