mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpilib] Improve Notifier docs (NFC) (#4326)
This commit is contained in:
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user