libcamera: libcamera::ThreadMain Class Reference

libcamera v0.2.0 Supporting cameras in Linux since 2019

Loading...
Searching...
No Matches
Protected Member Functions | List of all members
libcamera::ThreadMain Class Reference

Thread wrapper for the main thread. More...

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

## Protected Member Functions
void | run () override
| Main function of the thread.
Protected Member Functions inherited from libcamera::Thread
int | exec ()
| Enter the event loop.

## 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.
bool | wait (utils::duration duration=utils::duration::max())
| Wait for the thread to finish.
bool | isRunning ()
| Check if the thread is running.
EventDispatcher * | eventDispatcher ()
| Retrieve the event dispatcher.
void | dispatchMessages (Message::Type type=Message::Type::None)
| Dispatch posted messages for this thread.
Static Public Member Functions inherited from libcamera::Thread
static Thread * | current ()
| Retrieve the Thread instance for the current thread.
static pid_t | currentId ()
| Retrieve the ID of the current thread.
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:

- src/libcamera/base/thread.cpp