/[xulu]/trunk/src/appl/parallel/spmd/SyncPoint.java
ViewVC logotype

Contents of /trunk/src/appl/parallel/spmd/SyncPoint.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (show annotations)
Wed Feb 25 11:54:01 2009 UTC (15 years, 9 months ago) by mojays
File size: 2072 byte(s)
First Commit, corresponds to Revision 1008 of Wikisquare-SVN 
1 package appl.parallel.spmd;
2
3 /**
4 * Specifies details about a synchronization point. These points are used in
5 * the {@link AdvancedSPMDClientController} or {@link AdvancedSPMDServerController}
6 * as preloading-Points or multithread-barriers. They are associated with a priority.
7 *
8 * @author Dominik Appl
9 */
10 public class SyncPoint {
11
12 /**
13 * A high priority means a high priority on operating system level. It should
14 * be used by implementations of {@link AdvancedSPMDClientController} and {@link AdvancedSPMDServerController}
15 *
16 * @author Dominik Appl
17 */
18 public enum Priority
19 {
20 LOW(Thread.MIN_PRIORITY),
21 BELOW_NORMAL(Thread.NORM_PRIORITY-1),
22 NORMAL(Thread.NORM_PRIORITY),
23 ABOVE_NORMAL(Thread.NORM_PRIORITY+1),
24 HIGH(Thread.MAX_PRIORITY);
25
26 private final int realPriorityNo;
27
28 Priority(int realPriorityNo)
29 {
30 this.realPriorityNo=realPriorityNo;
31 }
32
33 /**
34 * @return the priority
35 */
36 public int getPriority(){
37 return realPriorityNo;
38 }
39
40 }
41 private final int id;
42 private final Priority priority;
43
44 /**
45 * Creates a new Sync-Point with normal priority
46 *
47 * @param pointID a id for this syncPoint
48 */
49 public SyncPoint(int pointID) {
50 this(pointID,Priority.NORMAL);
51 }
52
53 /**
54 * Creates a new Sync-Point with normal {@link Priority} (and with hashcode as id)
55 */
56 public SyncPoint() {
57 this.id = this.hashCode();
58 this.priority = Priority.NORMAL;
59 }
60
61 /**
62 * @param id a id for the
63 * @param priority
64 */
65 public SyncPoint(int id, Priority priority ) {
66 this.id = id;
67 this.priority = priority;
68 }
69
70 /**
71 * Creates a new Sync-Point with the given {@link Priority}
72 */
73 public SyncPoint(Priority priority) {
74 id = this.hashCode();
75 this.priority = priority;
76 }
77
78 /**
79 * @return the id
80 */
81 public int getId() {
82 return id;
83 }
84
85 /**
86 * @return the priority of the Thread (as system dependent for direct use in {@link Thread Threads})
87 */
88 public int getPriority() {
89 return priority.getPriority();
90 }
91 }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26