001/* 002 * $Id$ 003 */ 004 005package edu.jas.kern; 006 007 008/** 009 * PreemptStatus, defines global status for preemptive interruption handling. 010 * @author Heinz Kredel 011 */ 012 013public class PreemptStatus { 014 015 016 /** 017 * Global status flag. 018 */ 019 private static volatile boolean allowPreempt = true; 020 021 022 /** 023 * No public constructor. 024 */ 025 protected PreemptStatus() { 026 } 027 028 029 /** 030 * isAllowed. 031 * @return true, preemtive interruption is allowed, else false. 032 */ 033 public static boolean isAllowed() { 034 //System.out.println("allowPreempt: " + allowPreempt); 035 return allowPreempt; 036 } 037 038 039 /** 040 * setAllow, set preemtive interruption to allowed status. 041 */ 042 public static void setAllow() { 043 allowPreempt = true; 044 } 045 046 047 /** 048 * setNotAllow, set preemtive interruption to not allowed status. 049 */ 050 public static void setNotAllow() { 051 allowPreempt = false; 052 } 053 054}