Package edu.rit.pj
Class ParallelConstruct
java.lang.Object
edu.rit.pj.ParallelConstruct
- Direct Known Subclasses:
BarrierAction,ParallelForLoop,ParallelIteration,ParallelRegion,ParallelSection
Class ParallelConstruct is the common base class for all parallel constructs
that are executed by a ParallelTeam.
- Version:
- 20-Dec-2007
- Author:
- Alan Kaminsky
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal intDetermine the number of threads in the parallel team executing this parallel construct.final intDetermine the index of the calling thread in the parallel team executing this parallel construct.final booleanDetermine if a parallel team is executing this parallel construct.final ParallelRegionregion()Returns the parallel region of code within which a parallel team is executing this parallel construct.final ParallelTeamteam()Returns the parallel team that is executing this parallel construct.
-
Constructor Details
-
ParallelConstruct
public ParallelConstruct()Construct a new parallel construct.
-
-
Method Details
-
isExecutingInParallel
public final boolean isExecutingInParallel()Determine if a parallel team is executing this parallel construct.- Returns:
- True if a parallel team is executing this parallel construct, false otherwise.
-
team
Returns the parallel team that is executing this parallel construct.- Returns:
- Parallel team.
- Throws:
IllegalStateException- (unchecked exception) Thrown if no parallel team is executing this parallel construct.
-
region
Returns the parallel region of code within which a parallel team is executing this parallel construct.- Returns:
- Parallel region.
- Throws:
IllegalStateException- (unchecked exception) Thrown if no parallel team is executing this parallel construct.
-
getThreadCount
public final int getThreadCount()Determine the number of threads in the parallel team executing this parallel construct.- Returns:
- Number of threads in the thread team.
- Throws:
IllegalStateException- (unchecked exception) Thrown if no parallel team is executing this parallel construct.
-
getThreadIndex
public final int getThreadIndex()Determine the index of the calling thread in the parallel team executing this parallel construct.- Returns:
- Index of the calling thread in the range 0 ..
getThreadCount()-1. - Throws:
IllegalStateException- (unchecked exception) Thrown if no parallel team is executing this parallel construct. Thrown if the thread callinggetThreadIndex()is not part of the parallel team executing this parallel construct.
-