|
KiCad PCB EDA Suite
|
State shared by the owner and the worker thread; the thread keeps it alive after the owner is gone. More...
Public Types | |
| typedef std::vector< std::vector< DB_VALUE > > | BATCH |
Public Member Functions | |
| void | wake () |
| Wakes the owner and the worker, which may be waiting in either kind of wait. | |
| template<typename PRED> | |
| void | workerWait (std::unique_lock< std::mutex > &aLock, PRED aReady) |
| Waits on the worker thread for aReady with m held, dispatching window messages meanwhile if asked to. | |
| void | abandon () |
| Marks the running job as given up on, with m held by the caller. | |
| void | releaseSlot () |
| Returns the job's admission slot, with m held by the caller. | |
Static Public Member Functions | |
| static void | Main (std::shared_ptr< DB_WORKER_CORE > aCore, std::function< bool()> aInit, std::function< void()> aExit) |
| The thread body; owns aCore until the thread ends. | |
Public Attributes | |
| std::string | key |
| std::mutex | m |
| std::condition_variable | cv |
| std::function< void(DB_JOB_CONTEXT &)> | job |
| bool | hasJob = false |
| bool | busy = false |
| bool | done = false |
| bool | stop = false |
| std::atomic< bool > | initFailed { false } |
| std::atomic< bool > | abandoned { false } |
| std::atomic< bool > | rejected { false } |
| bool | exited = false |
| Set once the exit hook has returned. | |
| bool | slotHeld = false |
| std::deque< BATCH > | queue |
| size_t | pushed = 0 |
| size_t | consumed = 0 |
| std::exception_ptr | error |
| bool | pumpMessages = false |
| Windows only, the worker dispatches window messages whenever it waits. | |
State shared by the owner and the worker thread; the thread keeps it alive after the owner is gone.
Definition at line 126 of file db_worker_thread.cpp.
| typedef std::vector<std::vector<DB_VALUE> > DB_WORKER_CORE::BATCH |
Definition at line 128 of file db_worker_thread.cpp.
|
inline |
|
static |
The thread body; owns aCore until the thread ends.
Definition at line 316 of file db_worker_thread.cpp.
References abandoned, busy, done, error, exited, hasJob, initFailed, job, key, m, DB_JOB_CONTEXT::m_pending, DB_JOB_CONTEXT::pushBatch(), releaseSlot(), stop, wake(), and workerWait().
Referenced by DB_WORKER_THREAD::runJob().
|
inline |
Returns the job's admission slot, with m held by the caller.
Definition at line 227 of file db_worker_thread.cpp.
Referenced by Main().
|
inline |
Wakes the owner and the worker, which may be waiting in either kind of wait.
Definition at line 163 of file db_worker_thread.cpp.
References cv, and pumpMessages.
|
inline |
Waits on the worker thread for aReady with m held, dispatching window messages meanwhile if asked to.
Definition at line 175 of file db_worker_thread.cpp.
References cv, message, and pumpMessages.
Referenced by Main().
| std::atomic<bool> DB_WORKER_CORE::abandoned { false } |
Definition at line 140 of file db_worker_thread.cpp.
| bool DB_WORKER_CORE::busy = false |
Definition at line 136 of file db_worker_thread.cpp.
Referenced by Main().
| size_t DB_WORKER_CORE::consumed = 0 |
Definition at line 147 of file db_worker_thread.cpp.
| std::condition_variable DB_WORKER_CORE::cv |
Definition at line 132 of file db_worker_thread.cpp.
Referenced by wake(), and workerWait().
| bool DB_WORKER_CORE::done = false |
Definition at line 137 of file db_worker_thread.cpp.
Referenced by Main().
| std::exception_ptr DB_WORKER_CORE::error |
Definition at line 148 of file db_worker_thread.cpp.
Referenced by Main().
| bool DB_WORKER_CORE::exited = false |
Set once the exit hook has returned.
Definition at line 142 of file db_worker_thread.cpp.
Referenced by Main().
| bool DB_WORKER_CORE::hasJob = false |
Definition at line 135 of file db_worker_thread.cpp.
Referenced by Main().
| std::atomic<bool> DB_WORKER_CORE::initFailed { false } |
Definition at line 139 of file db_worker_thread.cpp.
Referenced by Main().
| std::function<void( DB_JOB_CONTEXT& )> DB_WORKER_CORE::job |
Definition at line 134 of file db_worker_thread.cpp.
Referenced by Main().
| std::string DB_WORKER_CORE::key |
Definition at line 130 of file db_worker_thread.cpp.
Referenced by abandon(), Main(), and releaseSlot().
| std::mutex DB_WORKER_CORE::m |
Definition at line 131 of file db_worker_thread.cpp.
| bool DB_WORKER_CORE::pumpMessages = false |
Windows only, the worker dispatches window messages whenever it waits.
Definition at line 150 of file db_worker_thread.cpp.
Referenced by wake(), and workerWait().
| size_t DB_WORKER_CORE::pushed = 0 |
Definition at line 146 of file db_worker_thread.cpp.
| std::deque<BATCH> DB_WORKER_CORE::queue |
Definition at line 145 of file db_worker_thread.cpp.
| std::atomic<bool> DB_WORKER_CORE::rejected { false } |
Definition at line 141 of file db_worker_thread.cpp.
| bool DB_WORKER_CORE::slotHeld = false |
Definition at line 144 of file db_worker_thread.cpp.
Referenced by releaseSlot().
| bool DB_WORKER_CORE::stop = false |
Definition at line 138 of file db_worker_thread.cpp.
Referenced by Main().