![]() |
Multithreading with Java? Anyone using it?
Specifically, I would like to put the camera and target detection on a separate thread, but would be interested in examples of doing anything in a separate thread.
|
Re: Multithreading with Java? Anyone using it?
We are doing a multithreaded application. I'm at home right now so I don't have any hand on code examples but for how to program using threads in java look into Thread class and the Runnable interface. Basically a threaded camera/targer would look something like this
Code:
public class Targeter implements Runnable{Also look into the synchronized keyword which is useful for making sure threads don't interrupt each other. Good luck ~Kenneth Team #2212 The Spikes |
Re: Multithreading with Java? Anyone using it?
If you have a look at the GRTFramework(code.google.com/p/grtframework), you'll notice that we use multithreading extensively, with sensor and actuator abstractions/drivers being independent threads, and controllers for specific robot mechanisms acting completely independently from each other. We have not noticed any real performance costs thus far, and thus strongly recommend a threaded model to segregated robot parts.
I'm not saying that threading has no performance costs, but for the purposes of this competition they are not noticeable even with java threads. |
| All times are GMT -5. The time now is 09:39. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi