1 /*
2 * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_GCTASKMANAGER_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_GCTASKMANAGER_HPP
27
28 #include "runtime/mutex.hpp"
29 #include "utilities/growableArray.hpp"
30
31 //
32 // The GCTaskManager is a queue of GCTasks, and accessors
33 // to allow the queue to be accessed from many threads.
34 //
35
36 // Forward declarations of types defined in this file.
37 class GCTask;
38 class GCTaskQueue;
39 class SynchronizedGCTaskQueue;
40 class GCTaskManager;
41 class NotifyDoneClosure;
42 // Some useful subclasses of GCTask. You can also make up your own.
43 class NoopGCTask;
44 class BarrierGCTask;
45 class ReleasingBarrierGCTask;
46 class NotifyingBarrierGCTask;
766 // State.
767 // Control multi-threaded access.
768 static Mutex* _lock;
769 // The list of available Monitor*'s.
770 static GrowableArray<Monitor*>* _freelist;
771 public:
772 // Reserve a Monitor*.
773 static Monitor* reserve();
774 // Release a Monitor*.
775 static void release(Monitor* instance);
776 private:
777 // Accessors.
778 static Mutex* lock() {
779 return _lock;
780 }
781 static GrowableArray<Monitor*>* freelist() {
782 return _freelist;
783 }
784 };
785
786 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_GCTASKMANAGER_HPP
|
1 /*
2 * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_GC_PARALLEL_GCTASKMANAGER_HPP
26 #define SHARE_VM_GC_PARALLEL_GCTASKMANAGER_HPP
27
28 #include "runtime/mutex.hpp"
29 #include "utilities/growableArray.hpp"
30
31 //
32 // The GCTaskManager is a queue of GCTasks, and accessors
33 // to allow the queue to be accessed from many threads.
34 //
35
36 // Forward declarations of types defined in this file.
37 class GCTask;
38 class GCTaskQueue;
39 class SynchronizedGCTaskQueue;
40 class GCTaskManager;
41 class NotifyDoneClosure;
42 // Some useful subclasses of GCTask. You can also make up your own.
43 class NoopGCTask;
44 class BarrierGCTask;
45 class ReleasingBarrierGCTask;
46 class NotifyingBarrierGCTask;
766 // State.
767 // Control multi-threaded access.
768 static Mutex* _lock;
769 // The list of available Monitor*'s.
770 static GrowableArray<Monitor*>* _freelist;
771 public:
772 // Reserve a Monitor*.
773 static Monitor* reserve();
774 // Release a Monitor*.
775 static void release(Monitor* instance);
776 private:
777 // Accessors.
778 static Mutex* lock() {
779 return _lock;
780 }
781 static GrowableArray<Monitor*>* freelist() {
782 return _freelist;
783 }
784 };
785
786 #endif // SHARE_VM_GC_PARALLEL_GCTASKMANAGER_HPP
|