1757N/A * Copyright (c) 2005, 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// Forward declarations 0N/A// Class YieldingFlexibleGangWorker: 0N/A// Several instances of this class run in parallel as workers for a gang. 0N/Aprotected:
// Override from parent class 1753N/A // The abstract work method. 1753N/A // The argument tells you which member of the gang you are. 0N/A// An abstract task to be worked on by a flexible work gang, 0N/A// and where the workers will periodically yield, usually 0N/A// in response to some condition that is signalled by means 0N/A// that are specific to the task at hand. 0N/A// You subclass this to supply your own work() method. 0N/A// A second feature of this kind of work gang is that 0N/A// it allows for the signalling of certain exceptional 0N/A// conditions that may be encountered during the performance 0N/A// of the task and that may require the task at hand to be 0N/A// `aborted' forthwith. Finally, these gangs are `flexible' 0N/A// in that they can operate at partial capacity with some 0N/A// gang workers waiting on the bench; in other words, the 0N/A// size of the active worker pool can flex (up to an apriori 0N/A// maximum) in response to task requests at certain points. 0N/A// The last part (the flexible part) has not yet been fully 0N/A// fleshed out and is a work in progress. 0N/A // Constructor and desctructor: only construct subclasses. 0N/A // The abstract work method. 0N/A // The argument tells you which member of the gang you are. 0N/A // Subclasses should call the parent's yield() method 0N/A // after having done any work specific to the subclass. 0N/A // An abstract method supplied by 0N/A // a concrete sub-class which is used by the coordinator 0N/A // to do any "central yielding" work. 0N/A // Subclasses should call the parent's abort() method 0N/A // after having done any work specific to the sunbclass. 0N/A// Class YieldingWorkGang: A subclass of WorkGang. 0N/A// In particular, a YieldingWorkGang is made up of 0N/A// YieldingGangWorkers, and provides infrastructure 0N/A// supporting yielding to the "GangOverseer", 0N/A// being the thread that orchestrates the WorkGang via run_task(). 0N/A // Here's the public interface to this class. 0N/A // Constructor and destructor. 1753N/A // Allocate a worker and return a pointer to it. 0N/A // Run a task; returns when the task is done, or the workers yield, 0N/A // or the task is aborted, or the work gang is terminated via stop(). 0N/A // A task that has been yielded can be continued via this same interface 0N/A // by using the same task repeatedly as the argument to the call. 0N/A // It is expected that the YieldingFlexibleGangTask carries the appropriate 0N/A // continuation information used by workers to continue the task 0N/A // from its last yield point. Thus, a completed task will return 0N/A // immediately with no actual work having been done by the workers. 0N/A // Abort a currently running task, if any; returns when all the workers 0N/A // have stopped working on the current task and have returned to their 0N/A // waiting stations. 0N/A // Yield: workers wait at their current working stations 0N/A // until signalled to proceed by the overseer. 0N/A // Abort: workers are expected to return to their waiting 0N/A // stations, whence they are ready for the next task dispatched 0N/A // Accessors for fields 1879N/A#
endif // SHARE_VM_UTILITIES_YIELDINGWORKGROUP_HPP