View Single Post
  #2   Spotlight this post!  
Unread 31-03-2010, 12:54
FRC4ME FRC4ME is offline
Registered User
FRC #0339
 
Join Date: Feb 2008
Rookie Year: 2007
Location: Fredericksburg, VA
Posts: 324
FRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant future
Re: Parallelism in Java

Create a class that implements interface Runnable, like this:

Code:
public class MyTask implements Runnable {
    public void run () {
        // Do stuff in here
    }
}
Then, in the main robot class, create a thread:

Code:
public Thread myThread = new Thread(new MyTask());
Start the thread in robotInit():

Code:
myThread.start(); // Will call MyTask.run() in a separate task
I think this is what you were thinking of already, no?
__________________
Go directly to queue. Do not pass pit.
Reply With Quote