RobotCore
1.0
WPILib port to raspberry Pi
Toggle main menu visibility
Loading...
Searching...
No Matches
EventVector.java
1
// Copyright (c) FIRST and other WPILib contributors.
2
// Open Source Software; you can modify and/or share it under the terms of
3
// the WPILib BSD license file in the root directory of this project.
4
5
package
org.wpilib.util.concurrent;
6
7
import
java.util.ArrayList;
8
import
java.util.List;
9
import
java.util.concurrent.locks.ReentrantLock;
10
import
org.wpilib.util.WPIUtilJNI;
11
13
public
class
EventVector
{
14
private
final
ReentrantLock m_lock =
new
ReentrantLock();
15
private
final
List<Integer> m_events =
new
ArrayList<>();
16
18
public
EventVector
() {}
19
25
public
void
add
(
int
handle) {
26
m_lock.lock();
27
try
{
28
m_events.add(handle);
29
}
finally
{
30
m_lock.unlock();
31
}
32
}
33
39
public
void
remove
(
int
handle) {
40
m_lock.lock();
41
try
{
42
m_events.removeIf(x -> x == handle);
43
}
finally
{
44
m_lock.unlock();
45
}
46
}
47
49
public
void
wakeup
() {
50
m_lock.lock();
51
try
{
52
for
(
int
eventHandle : m_events) {
53
WPIUtilJNI
.setEvent(eventHandle);
54
}
55
}
finally
{
56
m_lock.unlock();
57
}
58
}
59
}
org.wpilib.util.WPIUtilJNI
Definition
WPIUtilJNI.java:17
org.wpilib.util.concurrent.EventVector.EventVector
EventVector()
Definition
EventVector.java:18
org.wpilib.util.concurrent.EventVector.add
void add(int handle)
Definition
EventVector.java:25
org.wpilib.util.concurrent.EventVector.wakeup
void wakeup()
Definition
EventVector.java:49
org
wpilib
util
concurrent
EventVector.java
Generated by
1.18.0