Package mpe

Source Code of mpe.FrameLock

package mpe;

import java.util.concurrent.Semaphore;

/**
* Used as a wrapper for a binary semaphore to signal when a frame can be drawn.
* @author Brandt Westing TACC
*
*/
public class FrameLock {
 
  Semaphore frameLock_;
 
  public FrameLock()
  {
    frameLock_ = new Semaphore(1);
  }
 
  /**
   *
   */
  public void acquire()
  {
    try {
      frameLock_.acquire();
    } catch (InterruptedException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
 
  public void release()
  {
    frameLock_.release();
  }

}
TOP

Related Classes of mpe.FrameLock

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.