public class CountedSemaphore
extends java.util.concurrent.Semaphore
Constructor and Description |
---|
CountedSemaphore(int threadsRunning)
Construct a new semaphore.
|
CountedSemaphore(int threadsRunning,
int threadsWaiting)
Construct a new semaphore.
|
Modifier and Type | Method and Description |
---|---|
static void |
addSemaphore(java.lang.String id,
CountedSemaphore s)
Add a new semaphore to the semaphore table
|
static CountedSemaphore |
getSemaphore(java.lang.String id)
Get the semaphore with key 'id' from the semaphore table
|
void |
P()
Enter the critical section.
|
void |
V()
Leave the critical section.
|
acquire, acquire, acquireUninterruptibly, acquireUninterruptibly, availablePermits, drainPermits, getQueuedThreads, getQueueLength, hasQueuedThreads, isFair, reducePermits, release, release, toString, tryAcquire, tryAcquire, tryAcquire, tryAcquire
public CountedSemaphore(int threadsRunning)
threadsRunning
- how many threads can go into the critical section.public CountedSemaphore(int threadsRunning, int threadsWaiting)
threadsRunning
- how many threads can go into the critical section.threadsWaiting
- how many threads may wait.public static CountedSemaphore getSemaphore(java.lang.String id)
public static void addSemaphore(java.lang.String id, CountedSemaphore s)
public void P() throws QueueFullException
QueueFullException
- when waiting queue is full.public void V()
@enterprise 9.0.33982 Copyright © 2001-2023 Groiss Informatics GmbH. All Rights Reserved.