|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
com.trolltech.qt.QThread
public final class QThread
The QThread class extends the java.lang.Thread class and should be used when QObjects are used in threads. QObjects have object affinity, meaning that they belong to a given thread, accessible through their thread() method. It is only allowed to access a QObject from the thread it belongs to. To make this work together with garbage collection the class QThread has been introduced to ensure that the native resources used by QObjects are freed when the garbage collector is run. This is implemented by the garbage collector thread posting an event to the native QObject to delete itself when the threads event loop is idle. Before exiting the thread will do flush all events, causing all native QObjects to be deleted. The QThread class also adds two convenience signals, starting and finished. Started is emitted just before the runnable target is invoked. Finished is emitted just before the thread shuts down; after the execution of the runnable target and after the flushing of the event loop.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
QSignalEmitter.Signal0 |
finished
The finished signal is emitted after the QThread has finished executing its runnable target. |
QSignalEmitter.Signal0 |
starting
The starting signal is emitted when before the QThread invokes its runnable target. |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
QThread(java.lang.Runnable target)
Creates a new QThread with the specified invokable target |
|
QThread(java.lang.Runnable target,
java.lang.String name)
Creates a new QThread with the specified invokable target and the given name. |
|
QThread(java.lang.ThreadGroup group,
java.lang.Runnable target)
Creates a new QThread with the specified invokable target and thread group. |
|
QThread(java.lang.ThreadGroup group,
java.lang.Runnable target,
java.lang.String name)
Creates a new QThread with the specified invokable target, name and thread group. |
|
QThread(java.lang.ThreadGroup group,
java.lang.Runnable target,
java.lang.String name,
long stackSize)
Creates a new QThread with the specified invokable target, name, thread group and stack size. |
Method Summary | |
---|---|
void |
run()
Called by the thread to invoke the runnable target. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public QSignalEmitter.Signal0 starting
public QSignalEmitter.Signal0 finished
Constructor Detail |
---|
public QThread(java.lang.Runnable target)
target
- The invokable target.public QThread(java.lang.ThreadGroup group, java.lang.Runnable target)
group
- The thread group.target
- The target.public QThread(java.lang.Runnable target, java.lang.String name)
target
- The invokable target.name
- The name.public QThread(java.lang.ThreadGroup group, java.lang.Runnable target, java.lang.String name)
group
- The Thread grouptarget
- The invokable targetname
- The name.public QThread(java.lang.ThreadGroup group, java.lang.Runnable target, java.lang.String name, long stackSize)
group
- The Thread grouptarget
- The invokable targetname
- The name.stackSize
- The stack size.Method Detail |
---|
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
QObject.disposeLater()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |