Package edu.wpi.first.util
Class WPIUtilJNI
java.lang.Object
edu.wpi.first.util.WPIUtilJNI
- Direct Known Subclasses:
DataLogJNI
public class WPIUtilJNI extends Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WPIUtilJNI.Helper
-
Constructor Summary
Constructors Constructor Description WPIUtilJNI()
-
Method Summary
Modifier and Type Method Description static int
createEvent(boolean manualReset, boolean initialState)
static int
createSemaphore(int initialCount, int maximumCount)
static void
destroyEvent(int eventHandle)
static void
destroySemaphore(int semHandle)
static void
disableMockTime()
static void
enableMockTime()
static void
forceLoad()
Force load the library.static long
getSystemTime()
static long
now()
static boolean
releaseSemaphore(int semHandle, int releaseCount)
static void
resetEvent(int eventHandle)
static void
setEvent(int eventHandle)
static void
setMockTime(long time)
static void
waitForObject(int handle)
Waits for an handle to be signaled.static int[]
waitForObjects(int[] handles)
Waits for one or more handles to be signaled.static int[]
waitForObjectsTimeout(int[] handles, double timeout)
Waits for one or more handles to be signaled, with timeout.static boolean
waitForObjectTimeout(int handle, double timeout)
Waits for an handle to be signaled, with timeout.static void
writeStderr(String str)
-
Constructor Details
-
WPIUtilJNI
public WPIUtilJNI()
-
-
Method Details
-
forceLoad
Force load the library.- Throws:
IOException
- if the library failed to load
-
writeStderr
-
enableMockTime
-
disableMockTime
-
setMockTime
-
now
-
getSystemTime
-
createEvent
-
destroyEvent
-
setEvent
-
resetEvent
-
createSemaphore
-
destroySemaphore
-
releaseSemaphore
-
waitForObject
Waits for an handle to be signaled.- Parameters:
handle
- handle to wait on- Throws:
InterruptedException
- on failure (e.g. object was destroyed)
-
waitForObjectTimeout
Waits for an handle to be signaled, with timeout.- Parameters:
handle
- handle to wait ontimeout
- timeout in seconds- Returns:
- True if timeout reached without handle being signaled
- Throws:
InterruptedException
- on failure (e.g. object was destroyed)
-
waitForObjects
Waits for one or more handles to be signaled.Invalid handles are treated as signaled; the returned array will have the handle error bit set for any invalid handles.
- Parameters:
handles
- array of handles to wait on- Returns:
- array of signaled handles
- Throws:
InterruptedException
- on failure (e.g. no objects were signaled)
-
waitForObjectsTimeout
public static int[] waitForObjectsTimeout(int[] handles, double timeout) throws InterruptedExceptionWaits for one or more handles to be signaled, with timeout.Invalid handles are treated as signaled; the returned array will have the handle error bit set for any invalid handles.
- Parameters:
handles
- array of handles to wait ontimeout
- timeout in seconds- Returns:
- array of signaled handles; empty if timeout reached without any handle being signaled
- Throws:
InterruptedException
- on failure (e.g. no objects were signaled and no timeout)
-