Class SimpleSemaphore

java.lang.Object
com.compomics.util.threading.SimpleSemaphore

public class SimpleSemaphore
extends Object
A simple semaphore where thread interrupted exception are thrown as runtime exception.
Author:
Marc Vaudel
  • Constructor Details

    • SimpleSemaphore

      public SimpleSemaphore​(int nPermits, boolean fair)
      Constructor.
      Parameters:
      nPermits - the number of permits
      fair - boolean indicating whether threads should be processed in a fair way
    • SimpleSemaphore

      public SimpleSemaphore​(int nPermits)
      Constructor.
      Parameters:
      nPermits - the number of permits
  • Method Details

    • acquire

      public void acquire()
      Acquires.
    • release

      public void release()
      Releases.