122
|
1 /*******************************************************************************
|
|
2 * Copyright (c) 2003, 2006 IBM Corporation and others.
|
|
3 * All rights reserved. This program and the accompanying materials
|
|
4 * are made available under the terms of the Eclipse Public License v1.0
|
|
5 * which accompanies this distribution, and is available at
|
|
6 * http://www.eclipse.org/legal/epl-v10.html
|
|
7 *
|
|
8 * Contributors:
|
|
9 * IBM - Initial API and implementation
|
|
10 * Port to the D programming language:
|
|
11 * Frank Benoit <benoit@tionex.de>
|
|
12 *******************************************************************************/
|
|
13 module dwtx.core.internal.jobs.Deadlock;
|
|
14
|
167
|
15 import dwtx.dwtxhelper.JThread;
|
122
|
16
|
|
17 import dwt.dwthelper.utils;
|
|
18
|
|
19 import dwtx.core.runtime.jobs.ISchedulingRule;
|
|
20
|
|
21 /**
|
|
22 * The deadlock class stores information about a deadlock that just occurred.
|
|
23 * It contains an array of the threads that were involved in the deadlock
|
|
24 * as well as the thread that was chosen to be suspended and an array of locks
|
|
25 * held by that thread that are going to be suspended to resolve the deadlock.
|
|
26 */
|
|
27 class Deadlock {
|
|
28 //all the threads which are involved in the deadlock
|
167
|
29 private JThread[] threads;
|
122
|
30 //the thread whose locks will be suspended to resolve deadlock
|
167
|
31 private JThread candidate;
|
122
|
32 //the locks that will be suspended
|
|
33 private ISchedulingRule[] locks;
|
|
34
|
167
|
35 public this(JThread[] threads, ISchedulingRule[] locks, JThread candidate) {
|
122
|
36 this.threads = threads;
|
|
37 this.locks = locks;
|
|
38 this.candidate = candidate;
|
|
39 }
|
|
40
|
|
41 public ISchedulingRule[] getLocks() {
|
|
42 return locks;
|
|
43 }
|
|
44
|
167
|
45 public JThread getCandidate() {
|
122
|
46 return candidate;
|
|
47 }
|
|
48
|
167
|
49 public JThread[] getThreads() {
|
122
|
50 return threads;
|
|
51 }
|
|
52 }
|