libcamera  v0.3.1+12-19bbca3c
Supporting cameras in Linux since 2019
Protected Member Functions | List of all members
libcamera::ThreadMain Class Reference

Thread wrapper for the main thread. More...

Inheritance diagram for libcamera::ThreadMain:
Inheritance graph
[legend]
Collaboration diagram for libcamera::ThreadMain:
Collaboration graph
[legend]

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...
 
EventDispatchereventDispatcher ()
 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 Threadcurrent ()
 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.
 

Detailed Description

Thread wrapper for the main thread.

Member Function Documentation

◆ run()

void libcamera::ThreadMain::run ( )
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.


The documentation for this class was generated from the following file: