org.inria.ns.reflex.structures
Class Lockable.Monitor

java.lang.Object
  extended by org.inria.ns.reflex.structures.Lockable.Monitor
Enclosing interface:
Lockable

public static final class Lockable.Monitor
extends Object

A Monitor that suspends and resumes Threads thanks to Lockables.

Author:
Philippe Poulard

Method Summary
static void resume(Lockable lockable)
          Wake up the thread that is waiting, or that will wait.
static void suspend(Lockable lockable)
          Suspend the current thread.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

resume

public static void resume(Lockable lockable)
Wake up the thread that is waiting, or that will wait.

If the underlying thread that owns the lockable didn't have enough time to fall asleep before reaching this point, we ensure that this operation wouldn't be lost by letting it falling asleep before.

*** This method blocks until the thread that owns the lockable is suspended. ***

Parameters:
lockable - The lockable owned by the thread to resume.

suspend

public static void suspend(Lockable lockable)
                    throws InterruptedException
Suspend the current thread.

Parameters:
lockable - The lockable owned by the thread to suspend.
Throws:
InterruptedException - When the current thread is interrupted.