[wpilib] Improve Notifier docs (NFC) (#4326)

This commit is contained in:
Tyler Veness
2022-07-01 06:45:00 -07:00
committed by GitHub
parent add00a96ed
commit faa29d596c
2 changed files with 19 additions and 0 deletions

View File

@@ -19,6 +19,13 @@
namespace frc {
/**
* Notifiers run a callback function on a separate thread at a specified period.
*
* If StartSingle() is used, the callback will run once. If StartPeriodic() is
* used, the callback will run repeatedly with the given period until stop() is
* called.
*/
class Notifier {
public:
/**
@@ -95,6 +102,9 @@ class Notifier {
* interrupt occurs, the event will be immediately requeued for the same time
* interval.
*
* The user-provided callback should be written in a nonblocking manner so the
* callback can be recalled at the next periodic event notification.
*
* @param period Period to call the handler starting one period
* after the call to this method.
*/

View File

@@ -10,6 +10,12 @@ import edu.wpi.first.hal.NotifierJNI;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReentrantLock;
/**
* Notifiers run a callback function on a separate thread at a specified period.
*
* <p>If startSingle() is used, the callback will run once. If startPeriodic() is used, the callback
* will run repeatedly with the given period until stop() is called.
*/
public class Notifier implements AutoCloseable {
// The thread waiting on the HAL alarm.
private Thread m_thread;
@@ -178,6 +184,9 @@ public class Notifier implements AutoCloseable {
* notification. Each time the interrupt occurs, the event will be immediately requeued for the
* same time interval.
*
* <p>The user-provided callback should be written in a nonblocking manner so the callback can be
* recalled at the next periodic event notification.
*
* @param periodSeconds Period in seconds to call the handler starting one period after the call
* to this method.
*/