You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using Semaphores becomes an issue if "permits" are lost, e.g., if an exception is thrown between acquiring and releasing a permit.
semaphore.acquire();
// do something that causes an exceptionsemaphore.release();
To this end, it should look like the following:
semaphore.acquire();
try {
// do something that causes an exception
} finally {
semaphore.release();
}
It should be noted that the try block does not need a catch block, i.e., it is not necessary to handle the exception at this place. The important point is that releasing the permit is done within the finally block and will be executed whenever the program leaves the try block.
Task
We should go through all usages of Semaphores in GERBIL to ensure that all of them are used like described above. This is necessary to avoid issues like #348.
The text was updated successfully, but these errors were encountered:
Description
Using Semaphores becomes an issue if "permits" are lost, e.g., if an exception is thrown between acquiring and releasing a permit.
To this end, it should look like the following:
It should be noted that the
try
block does not need acatch
block, i.e., it is not necessary to handle the exception at this place. The important point is that releasing the permit is done within thefinally
block and will be executed whenever the program leaves thetry
block.Task
We should go through all usages of Semaphores in GERBIL to ensure that all of them are used like described above. This is necessary to avoid issues like #348.
The text was updated successfully, but these errors were encountered: