01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: package org.apache.harmony.kernel.vm;
19:
20: import java.security.AccessController;
21: import java.security.PrivilegedAction;
22:
23: /**
24: * <p>
25: * This class must be implemented by the VM to support the Threading subsystem.
26: * </p>
27: */
28: public class Threads {
29:
30: private static final Threads INSTANCE = new Threads();
31:
32: /**
33: * <p>
34: * Retrieves an instance of the Threads service.
35: * </p>
36: *
37: * @return An instance of Threads.
38: */
39: public static Threads getInstance() {
40: // TODO add class loader check
41: return AccessController
42: .doPrivileged(new PrivilegedAction<Threads>() {
43: public Threads run() {
44: return INSTANCE;
45: }
46: });
47: }
48:
49: private Threads() {
50: super ();
51: }
52:
53: /**
54: * <p>
55: * Unparks the {@link Thread} that's passed.
56: * </p>
57: *
58: * @param thread The {@link Thread} to unpark.
59: */
60: public void unpark(Thread thread) {
61: return;
62: }
63:
64: /**
65: * <p>
66: * Park the {@link Thread#currentThread() current thread} for the specified
67: * number of nanoseconds.
68: * </p>
69: *
70: * @param nanoseconds The number of nanoseconds to park the current thread.
71: */
72: public void parkFor(long nanoseconds) {
73:
74: }
75:
76: /**
77: * <p>
78: * Park the {@link Thread#currentThread() current thread} until the
79: * specified time, as defined by {@link System#currentTimeMillis()}.
80: * </p>
81: *
82: * @param time The absolute time to park the current thread until.
83: */
84: public void parkUntil(long time) {
85:
86: }
87: }
|