2 * Copyright (C) 2014, United States Government, as represented by the
3 * Administrator of the National Aeronautics and Space Administration.
6 * The Java Pathfinder core (jpf-core) platform is licensed under the
7 * Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0.
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 package gov.nasa.jpf.vm.multiProcess;
21 import java.util.ArrayList;
22 import java.util.List;
24 import gov.nasa.jpf.annotation.MJI;
25 import gov.nasa.jpf.vm.MJIEnv;
26 import gov.nasa.jpf.vm.NativePeer;
27 import gov.nasa.jpf.vm.ThreadInfo;
30 * @author Nastaran Shafiei <nastaran.shafiei@gmail.com>
32 public class JPF_gov_nasa_jpf_vm_multiProcess_ThreadTest extends NativePeer {
33 private static List<Integer> prcIds = new ArrayList<Integer>();
35 protected static void resetPrcIds() {
39 private static List<ThreadInfo> threads = new ArrayList<ThreadInfo>();
41 protected static void resetThreads() {
46 public void keepThread__Ljava_lang_Thread_2I__V(MJIEnv env, int objRef, int thdRef, int prcId) {
47 ThreadInfo ti = env.getThreadInfoForObjRef(thdRef);
48 if(!prcIds.contains(prcId)) {
54 protected static List<ThreadInfo> getThreads() {
58 private static List<Integer> threadIds = new ArrayList<Integer>();
61 public static void addToThreads__Ljava_lang_Thread_2__V (MJIEnv env, int objRef, int thdRef) {
62 ThreadInfo ti = env.getThreadInfoForObjRef(thdRef);
65 if(!threadIds.contains(id)) {
70 protected static List<Integer> getThreadIds() {