7 #ifndef __LIBCAMERA_INTERNAL_THREAD_H__
8 #define __LIBCAMERA_INTERNAL_THREAD_H__
12 #include <sys/types.h>
21 class EventDispatcher;
37 void exit(
int code = 0);
60 void postMessage(std::unique_ptr<Message> msg,
Object *receiver);
61 void removeMessages(
Object *receiver);
67 void moveObject(
Object *
object);
Interface to manage the libcamera events and timers.
Definition: event_dispatcher.h:18
Base object to support automatic signal disconnection.
Definition: object.h:25
Generic signal and slot communication mechanism.
Definition: signal.h:39
Thread-local internal data.
Definition: thread.cpp:138
Thread wrapper for the main thread.
Definition: thread.cpp:170
A thread of execution.
Definition: thread.h:31
static Thread * current()
Retrieve the Thread instance for the current thread.
Definition: thread.cpp:419
static pid_t currentId()
Retrieve the ID of the current thread.
Definition: thread.cpp:433
EventDispatcher * eventDispatcher()
Retrieve the event dispatcher.
Definition: thread.cpp:474
void dispatchMessages()
Dispatch all posted messages for this thread.
Definition: thread.cpp:557
int exec()
Enter the event loop.
Definition: thread.cpp:301
void exit(int code=0)
Stop the thread's event loop.
Definition: thread.cpp:352
void setEventDispatcher(std::unique_ptr< EventDispatcher > dispatcher)
Set the event dispatcher.
Definition: thread.cpp:452
void start()
Start the thread.
Definition: thread.cpp:249
virtual void run()
Main method of the thread.
Definition: thread.cpp:327
Signal< Thread * > finished
Signal the end of thread execution.
Definition: thread.h:42
bool wait(utils::duration duration=utils::duration::max())
Wait for the thread to finish.
Definition: thread.cpp:375
bool isRunning()
Check if the thread is running.
Definition: thread.cpp:404
Thread()
Create a thread.
Definition: thread.cpp:234
Signal & slot implementation.
std::unique_lock< std::mutex > MutexLocker
An alias for std::unique_lock<std::mutex>
Definition: thread.h:28
std::mutex Mutex
An alias for std::mutex.
Definition: thread.h:27
Miscellaneous utility functions.
std::chrono::steady_clock::duration duration
The libcamera duration related to libcamera::utils::clock.
Definition: utils.h:66