WPILibC++
2020.3.2
ListenerExecutor.h
1
/*----------------------------------------------------------------------------*/
2
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
3
/* Open Source Software - may be modified and shared by FRC teams. The code */
4
/* must be accompanied by the FIRST BSD license file in the root directory of */
5
/* the project. */
6
/*----------------------------------------------------------------------------*/
7
8
#pragma once
9
10
#include <functional>
11
#include <vector>
12
13
#include <wpi/mutex.h>
14
15
namespace
frc::detail {
22
class
ListenerExecutor
{
23
public
:
29
void
Execute
(std::function<
void
()> task);
30
34
void
RunListenerTasks
();
35
36
private
:
37
std::vector<std::function<void()>> m_tasks;
38
std::vector<std::function<void()>> m_runningTasks;
39
wpi::mutex m_lock;
40
};
41
}
// namespace frc::detail
frc::detail::ListenerExecutor::RunListenerTasks
void RunListenerTasks()
Runs all posted tasks.
frc::detail::ListenerExecutor
An executor for running listener tasks posted by Sendable listeners synchronously from the main appli...
Definition:
ListenerExecutor.h:22
frc::detail::ListenerExecutor::Execute
void Execute(std::function< void()> task)
Posts a task to the executor to be run synchronously from the main thread.
wpilibc
src
main
native
include
frc
smartdashboard
ListenerExecutor.h
Generated on Fri Feb 21 2020 08:50:36 for WPILibC++ by
1.8.16