task.hpp revision 3863
1879N/A * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A// A PeriodicTask has the sole purpose of executing its task 0N/A// function with regular intervals. 0N/A// PeriodicTask pf(10); 0N/A // Useful constants. 0N/A // The interval constants are used to ensure the declared interval 0N/A // is appropriate; it must be between min_interval and max_interval, 0N/A // and have a granularity of interval_gran (all in millis). static int _ticks;
// total number of ticks // Only the WatcherThread can cause us to execute PeriodicTasks // Tells whether is enrolled // NOTE: this may only be called before the WatcherThread has been started // Make the task deactive // NOTE: this may only be called either while the WatcherThread is // inactive or by a task from within its task() method. One-shot or // several-shot tasks may be implemented this way. // Returns how long (time in milliseconds) before the next time we should // Calculate when the next periodic task will fire. // Called by the WatcherThread's run method. // This assumes that periodic tasks aren't entering the system // dynamically, except for during startup. // Don't wait any more; shut down the thread since we don't // currently support dynamic enrollment. // The task to perform at each period #
endif // SHARE_VM_RUNTIME_TASK_HPP