All Packages This Package Class Hierarchy Class Search Index
Class com.syncbuilder.util.TimeSlicer
java.lang.Object
|
+----com.syncbuilder.util.TimeSlicer
public class TimeSlicer
extends java.lang.Object
implements java.lang.Runnable
{
// Constructors 1
public TimeSlicer(int);
// Methods 4
public synchronized void addThread(Thread);
public void run();
public synchronized void start();
public synchronized void stop();
}
This class simulates time-sliced multi-threading on a system
that can only provide round-robin green threads.
public TimeSlicer(int base_priority)
public void run()
The core of the scheduler. It works like this:
There is one master thread which runs with a priority of
base_priority + 2 (this run()-method actually is the run()-
method of that thread). This master thread takes one of the
threads it is supposed to schedule, raises that thread's priority
to base_priority + 1, and then goes to sleep, thus giving the
thread with the raised priority a chance to run. When the
master thread wakes up, it puts the thread's priority back to
base_priority, like all the other threads, and picks the next
thread for execution, raises that thread's priority, ...
- Implements:
- run in interface Runnable
public synchronized void start()
public synchronized void stop()
public synchronized void addThread(Thread thread)
All Packages This Package Class Hierarchy Class Search Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7