![]() |
Vault
4.1
|
The VMainThread is a special case that is intended to be declared and called by the application's main function as follows: int main(int argc, char** argv) { VMainThread mainThread; return mainThread.execute(argc, argv); } This allows Vault to have a VThread object to represent the main thread, even though it is not a VThread-launched thread. More...
#include <vthread.h>
Public Member Functions | |
| virtual void | start () |
| Starts the thread by creating whatever OS-specific resources are necessary, and invoking the thread main, resulting in the VThread subclass' run() method being called. | |
| virtual void | run () |
| Override required in each VThread subclass, run() does whatever the thread is designed to do, and returns when the thread has completed its task or detects that isRunning() returns false. | |
| int | execute (int argc, char **argv) |
The VMainThread is a special case that is intended to be declared and called by the application's main function as follows: int main(int argc, char** argv) { VMainThread mainThread; return mainThread.execute(argc, argv); } This allows Vault to have a VThread object to represent the main thread, even though it is not a VThread-launched thread.
Therefore you can call VThread::getCurrentThread() from the main thread and it will return the VMainThread object. You must not "start" the VMainThread, because it is not a real VThread. If you do, its start() method will throw. VMainThread's execute() method simply calls VThread::userMain() which is defined by the application as always.
| virtual void VMainThread::run | ( | ) | [inline, virtual] |
Override required in each VThread subclass, run() does whatever the thread is designed to do, and returns when the thread has completed its task or detects that isRunning() returns false.
If the thread is designed to be stoppable from another thread, then its run() method must check the isRunning() property periodically and return when the property becomes false.
Implements VThread.