![]() |
Keyple Util C++ Library 2.0.0
Reference Terminal Reader API for C++
|
#include <Thread.h>
Classes | |
| class | UncaughtExceptionHandler |
Public Member Functions | |
| Thread (const std::string &name) | |
| Thread () | |
| virtual | ~Thread ()=default |
| void | setName (const std::string &name) |
| void | start () |
| void | run () |
| int | join () |
| bool | isAlive () |
| void | interrupt () |
| bool | isInterrupted () const |
| std::string | getName () |
| void | setUncaughtExceptionHandler (std::shared_ptr< UncaughtExceptionHandler > eh) |
Static Public Member Functions | |
| static void | sleep (long millis) |
Protected Attributes | |
| bool | mDone |
|
inline |
|
inline |
|
virtualdefault |
Destructor
|
inline |
|
inline |
Interrupts this thread.
Unless the current thread is interrupting itself, which is always permitted, the checkAccess method of this thread is invoked, which may cause a SecurityException to be thrown.
If this thread is blocked in an invocation of the wait(), wait(long), or wait(long, int) methods of the Object class, or of the join(), join(long), join(long, int), sleep(long), or sleep(long, int), methods of this class, then its interrupt status will be cleared and it will receive an InterruptedException.
If this thread is blocked in an I/O operation upon an interruptible channel then the channel will be closed, the thread's interrupt status will be set, and the thread will receive a ClosedByInterruptException.
If this thread is blocked in a Selector then the thread's interrupt status will be set and it will return immediately from the selection operation, possibly with a non-zero value, just as if the selector's wakeup method were invoked.
If none of the previous conditions hold then this thread's interrupt status will be set.
Interrupting a thread that is not alive need not have any effect.
| SecurityException | if the current thread cannot modify this thread |
|
inline |
|
inline |
By default Pthreads are joinable. meaning you can wait for them to complete with a call to pthread_join(). The Thread class join method checks to see if the thread is running, then calls this function to wait for the thread to complete. If the call is successful the thread is marked as detached since pthread_join() automatically detatches a thread.
|
inline |
|
inline |
|
inlinestatic |
Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds, subject to the precision and accuracy of system timers and schedulers. The thread does not lose ownership of any monitors.
| millis | the length of time to sleep in milliseconds |
| IllegalArgumentException | if the value of millis is negative |
| InterruptedException | if any thread has interrupted the current thread. The interrupted status of the current thread is cleared when this exception is thrown. static void sleep(long millis) throw(InterruptedException) |
|
inline |
Causes this thread to begin execution.
The result is that two threads are running concurrently: the current thread (which returns from the call to the start method) and the other thread (which executes its run method).
It is never legal to start a thread more than once. In particular, a thread may not be restarted once it has completed execution.
| IllegalThreadStateException | if the thread was already started. |