Multithreading

This is where you talk about the EV3 software itself, installation issues, and programming talk.

Moderators: roger, gloomyandy, skoehler

Multithreading

Postby msx » Thu Apr 17, 2014 9:12 am

Hello, the question is: does leJOS support multithreading?

What i'd like to do is to handle one sensor and motor with one thread, and other sensors and motors with another. Any limitation in this ? Can i eventually access the display from both threads ?

Thanks
msx
New User
 
Posts: 8
Joined: Thu Sep 05, 2013 8:35 am

Re: Multithreading

Postby lawrie » Thu Apr 17, 2014 9:09 pm

leJOS uses a standard Oracle Java VM and supports multitheading. You can access the LCD from any thread. In general the leJOS API is not thread safe, so if you access the same resource from multiple threads, you may have to use synchronization.
lawrie
leJOS Team Member
 
Posts: 929
Joined: Mon Feb 05, 2007 1:27 pm

Re: Multithreading

Postby Aswin » Thu Apr 17, 2014 11:15 pm

The SampleThread filter can be used to query a sensor at regular intervals in a seperate thread. You can place additional filters between the sensor and this filter for additional functionallity (moving average, calibration, etcetera).

Aswin
My NXT blog: http://nxttime.wordpress.com/
Aswin
leJOS Team Member
 
Posts: 206
Joined: Tue Apr 26, 2011 9:18 pm
Location: Netherlands


Return to EV3 Software

Who is online

Users browsing this forum: No registered users and 4 guests

more stuff