libcamera
v0.3.2+116-83c5ad0f
Supporting cameras in Linux since 2019
|
Thread wrapper for the main thread. More...
Protected Member Functions | |
void | run () override |
Main function of the thread. More... | |
Protected Member Functions inherited from libcamera::Thread | |
int | exec () |
Enter the event loop. More... | |
Additional Inherited Members | |
Public Member Functions inherited from libcamera::Thread | |
Thread () | |
Create a thread. | |
void | start () |
Start the thread. | |
void | exit (int code=0) |
Stop the thread's event loop. More... | |
bool | wait (utils::duration duration=utils::duration::max()) |
Wait for the thread to finish. More... | |
bool | isRunning () |
Check if the thread is running. More... | |
EventDispatcher * | eventDispatcher () |
Retrieve the event dispatcher. More... | |
void | dispatchMessages (Message::Type type=Message::Type::None) |
Dispatch posted messages for this thread. More... | |
Static Public Member Functions inherited from libcamera::Thread | |
static Thread * | current () |
Retrieve the Thread instance for the current thread. More... | |
static pid_t | currentId () |
Retrieve the ID of the current thread. More... | |
Public Attributes inherited from libcamera::Thread | |
Signal | finished |
Signal the end of thread execution. | |
Thread wrapper for the main thread.
|
inlineoverrideprotectedvirtual |
Main function of the thread.
When the thread is started with start(), it calls this function in the context of the new thread. The run() function can be overridden to perform custom work, either custom initialization and cleanup before and after calling the Thread::exec() function, or a custom thread loop altogether. When this function returns the thread execution is stopped, and the finished signal is emitted.
Note that if this function is overridden and doesn't call Thread::exec(), no events will be dispatched to the objects living in the thread. These objects will not be able to use the EventNotifier, Timer or Message facilities. This includes functions that rely on message dispatching, such as Object::deleteLater().
The base implementation just calls exec().
Reimplemented from libcamera::Thread.