Mercurial > projects > dwt-addons
comparison dwtx/core/internal/jobs/Deadlock.d @ 122:9d0585bcb7aa
Add core.jobs package
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Tue, 12 Aug 2008 02:34:21 +0200 |
parents | |
children | 862b05e0334a |
comparison
equal
deleted
inserted
replaced
121:c0304616ea23 | 122:9d0585bcb7aa |
---|---|
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 | |
15 import tango.core.Thread; | |
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 | |
29 private Thread[] threads; | |
30 //the thread whose locks will be suspended to resolve deadlock | |
31 private Thread candidate; | |
32 //the locks that will be suspended | |
33 private ISchedulingRule[] locks; | |
34 | |
35 public this(Thread[] threads, ISchedulingRule[] locks, Thread candidate) { | |
36 this.threads = threads; | |
37 this.locks = locks; | |
38 this.candidate = candidate; | |
39 } | |
40 | |
41 public ISchedulingRule[] getLocks() { | |
42 return locks; | |
43 } | |
44 | |
45 public Thread getCandidate() { | |
46 return candidate; | |
47 } | |
48 | |
49 public Thread[] getThreads() { | |
50 return threads; | |
51 } | |
52 } |