|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.wpi.first.wpilibj.communication.Semaphore
public class Semaphore
Class exposing VxWorks semaphores.
Nested Class Summary | |
---|---|
static class |
Semaphore.Options
Options to create a semaphore with. |
Field Summary | |
---|---|
static int |
WAIT_FOREVER
Integer ms value indicating wait forever. |
Constructor Summary | |
---|---|
Semaphore(Semaphore.Options options)
Create a new semaphore. |
|
Semaphore(Semaphore.Options options,
boolean initialState)
Create a semaphore with the given initial state. |
|
Semaphore(Semaphore.Options options,
int count)
Create a counting semaphore with the given value. |
Method Summary | |
---|---|
void |
close()
Close the semaphore. |
void |
flush()
Unblock every task that is blocked by the semaphore. |
void |
free()
Release all resources associated with the semaphore. |
Pointer |
getPointer()
Get the pointer to the native semaphore. |
void |
give()
Release the semaphore. |
void |
takeForever()
Take the semaphore. |
void |
takeMillis(int timeout)
Take the semaphore. |
boolean |
tryTake()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int WAIT_FOREVER
Constructor Detail |
---|
public Semaphore(Semaphore.Options options)
options
- The options to create the semaphore with.public Semaphore(Semaphore.Options options, boolean initialState)
options
- The options to create the semaphore with.initialState
- The initial state for the semaphore to have.public Semaphore(Semaphore.Options options, int count)
options
- The options to create the semaphore with.count
- The initial count for the semaphore to hold.Method Detail |
---|
public Pointer getPointer()
public void flush() throws SemaphoreException
SemaphoreException
public void give() throws SemaphoreException
SemaphoreException
public void takeMillis(int timeout) throws SemaphoreException
timeout
- The maximum time in milliseconds to block for the semaphore.
SemaphoreException
- if the lock can't be take in timeout seconds, or some other semaphore error condition occurs.public void takeForever() throws SemaphoreException
SemaphoreException
- if some semaphore error condition occurs.public boolean tryTake() throws SemaphoreException
SemaphoreException
public void close() throws SemaphoreException
SemaphoreException
public void free() throws SemaphoreException
SemaphoreException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |