Loader refactored (#235)
- Moved all Loader functionality into Loader class - Improvement for Dispatcher construction - Dispatcher and DispatcherThread: you can now specify the timeout when calling `dispatch()`. Default timeout is max timeout.
This commit is contained in:
committed by
GitHub
parent
bd2786b122
commit
de46401d85
@@ -15,10 +15,10 @@ Dispatcher::~Dispatcher() {
|
||||
mutex.unlock();
|
||||
}
|
||||
|
||||
void Dispatcher::dispatch(Function function, std::shared_ptr<void> context) {
|
||||
void Dispatcher::dispatch(Function function, std::shared_ptr<void> context, TickType_t timeout) {
|
||||
auto message = std::make_shared<DispatcherMessage>(function, std::move(context));
|
||||
// Mutate
|
||||
if (mutex.lock(1000 / portTICK_PERIOD_MS)) {
|
||||
if (mutex.lock(timeout)) {
|
||||
queue.push(std::move(message));
|
||||
if (queue.size() == BACKPRESSURE_WARNING_COUNT) {
|
||||
TT_LOG_W(TAG, "Backpressure: You're not consuming fast enough (100 queued)");
|
||||
|
||||
Reference in New Issue
Block a user