|
|||||||||
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, i.e., instances of classes that inherit from QObject, are used in threads. Thread may be used for all other classes that inherit from QtJambiObject.
QObjects have object affinity, i.e., they belong to a given thread, which is accessed through their thread() method. It is only allowed to access a QObject from the thread to which it belongs.
The QThread class was introduced to ensure that native resources are freed when QObjects are garbage collected. The garbage collector thread posts an event to the native QObject, which then deletes itself. Before exiting, the thread will flush all events - causing all native QObjects to be deleted.
QThread has 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 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 |