blob: 513f5fc3e14d0ffb69a055db695930b32bae4e95 [file] [log] [blame]
Brian Silverman425492b2015-12-30 15:23:55 -08001#ifndef FRC971_WPILIB_PDP_FETCHER_H_
2#define FRC971_WPILIB_PDP_FETCHER_H_
3
Brian Silverman425492b2015-12-30 15:23:55 -08004#include <atomic>
Parker Schuhd3b7a8872018-02-19 16:42:27 -08005#include <memory>
Brian Silverman425492b2015-12-30 15:23:55 -08006
7namespace frc971 {
8namespace wpilib {
9
10// Handles fetching values from the PDP. This is slow, so it has to happen in a
11// separate thread.
12class PDPFetcher {
13 public:
Brian Silverman425492b2015-12-30 15:23:55 -080014 void Quit() { run_ = false; }
15
Brian Silverman425492b2015-12-30 15:23:55 -080016 // To be called by a ::std::thread.
17 void operator()();
18
19 private:
Brian Silverman425492b2015-12-30 15:23:55 -080020 ::std::atomic<bool> run_{true};
21};
22
23} // namespace wpilib
24} // namespace frc971
25
26#endif // FRC971_WPILIB_PDP_FETCHER_H_