ca.nengo.util.impl
Class NodeThreadPool

java.lang.Object
  extended by ca.nengo.util.impl.NodeThreadPool
Direct Known Subclasses:
GPUNodeThreadPool

public class NodeThreadPool
extends java.lang.Object

A pool of threads for running nodes in. All interaction with the threads is done through this class

Author:
Eric Crawford

Field Summary
protected static int defaultNumThreads
           
protected  boolean isSleeping
           
protected  float myEndTime
           
protected  boolean myKill
           
protected  java.lang.Object myLock
           
protected  Node[] myNodeArray
           
protected  java.util.concurrent.LinkedBlockingQueue<Node> myNodes
           
protected  NodeThread[] myNodeThreads
           
protected  int myNumNodesProcessed
           
protected  int myNumNodesRequired
           
protected static int myNumThreads
           
protected  float myStartTime
           
 
Constructor Summary
protected NodeThreadPool()
           
  NodeThreadPool(Node[] nodes)
           
 
Method Summary
 void finishedANode()
           
 boolean finishedRun()
           
 float getEndTime()
           
 Node getNextNode()
           
static int getNumThreads()
           
 float getStartTime()
           
protected  void initialize(Node[] nodes)
           
static boolean isMultithreading()
           
 void kill()
           
static void setNumThreads(int value)
           
 void step(float startTime, float endTime)
           
static void turnOffMultithreading()
           
protected  void waitForThreads()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultNumThreads

protected static final int defaultNumThreads
See Also:
Constant Field Values

myNumThreads

protected static int myNumThreads

myNodeThreads

protected NodeThread[] myNodeThreads

myLock

protected java.lang.Object myLock

myNodes

protected java.util.concurrent.LinkedBlockingQueue<Node> myNodes

myNodeArray

protected Node[] myNodeArray

myNumNodesRequired

protected int myNumNodesRequired

myNumNodesProcessed

protected int myNumNodesProcessed

myStartTime

protected volatile float myStartTime

myEndTime

protected volatile float myEndTime

isSleeping

protected volatile boolean isSleeping

myKill

protected volatile boolean myKill
Constructor Detail

NodeThreadPool

protected NodeThreadPool()

NodeThreadPool

public NodeThreadPool(Node[] nodes)
Method Detail

getNumThreads

public static int getNumThreads()

setNumThreads

public static void setNumThreads(int value)

isMultithreading

public static boolean isMultithreading()

turnOffMultithreading

public static void turnOffMultithreading()

getStartTime

public float getStartTime()

getEndTime

public float getEndTime()

finishedRun

public boolean finishedRun()

initialize

protected void initialize(Node[] nodes)

step

public void step(float startTime,
                 float endTime)

waitForThreads

protected void waitForThreads()

kill

public void kill()

getNextNode

public Node getNextNode()

finishedANode

public void finishedANode()