|
KiCad PCB EDA Suite
|
Runs a slow probe once on a thread of its own and keeps its answer for good. More...
#include <db_backend_support.h>
Public Member Functions | |
| DB_PROBE_LATCH (std::function< T()> aProbe) | |
| std::optional< T > | Get (std::chrono::milliseconds aWait) |
| The probe's answer, or nothing if it has not finished within aWait. A probe that throws answers T(). | |
Private Attributes | |
| std::function< T()> | m_probe |
| std::once_flag | m_started |
| std::shared_future< T > | m_answer |
Runs a slow probe once on a thread of its own and keeps its answer for good.
Only a finished answer is kept. A caller that gives up waiting gets nothing, and the next caller waits on the same probe, so contention that delays the probe is never taken for a negative result.
Definition at line 128 of file db_backend_support.h.
|
inlineexplicit |
Definition at line 131 of file db_backend_support.h.
|
inline |
|
private |
Definition at line 172 of file db_backend_support.h.
Referenced by Get().
|
private |
Definition at line 170 of file db_backend_support.h.
Referenced by DB_PROBE_LATCH(), and Get().
|
private |
Definition at line 171 of file db_backend_support.h.
Referenced by Get().