Go to Post People misuse GP because they see Dean as some sort of whimsical cross between the Nutty Professor and Mister Rogers and think that FIRST is Disney World and we're all going to happily hold hands around the campfire and sing happy songs all day long. - Koko Ed [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 28-01-2012, 15:36
Varriount Varriount is offline
Registered User
FRC #2421
 
Join Date: Jan 2012
Location: Virginia
Posts: 5
Varriount is an unknown quantity at this point
Questions on WPILib components thread usage

Hello, my team has just started programming in java, and we've studied the documentation of WPILib, however some of us still have questions regarding thread safety and thread usage of WPILib's components.
What, if any, components of WPILib use threads? (Not including java's native thread library)
Does the VM on the cRio do any sort of automatic background threading or threading without the explicit usage of thread objects, in such a way that we would need to ensure the thread safety of our code?
Reply With Quote
  #2   Spotlight this post!  
Unread 28-01-2012, 18:26
Chiller Chiller is offline
Registered User
AKA: Connor Christie
FRC #4095 (RoXI Robotics)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Wisconsin
Posts: 118
Chiller is on a distinguished road
Re: Questions on WPILib components thread usage

Yes, all screw holes are threaded.
Reply With Quote
  #3   Spotlight this post!  
Unread 29-01-2012, 12:29
Varriount Varriount is offline
Registered User
FRC #2421
 
Join Date: Jan 2012
Location: Virginia
Posts: 5
Varriount is an unknown quantity at this point
Re: Questions on WPILib components thread usage

Um, excuse me? Chiller, could you clarify?
Reply With Quote
  #4   Spotlight this post!  
Unread 29-01-2012, 15:00
krieck's Avatar
krieck krieck is offline
Registered User
AKA: Keith
FRC #2846 (Firebears)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Minnesota
Posts: 49
krieck is an unknown quantity at this point
Re: Questions on WPILib components thread usage

Digging through the WPILIBJ source code, I can see a couple of threads created, but only for minor asynchronous communication. Preferences, for instance, are saved and retrieved in a separate thread. Some of the networktable methods manage connections in separate threads.

The actual robot code seems to run entirely in a single thread.

Thread-safety is a good topic to discuss and an important discipline to remember, but I think that it will not be an issue in your robot code.
Reply With Quote
  #5   Spotlight this post!  
Unread 29-01-2012, 15:20
Varriount Varriount is offline
Registered User
FRC #2421
 
Join Date: Jan 2012
Location: Virginia
Posts: 5
Varriount is an unknown quantity at this point
Re: Questions on WPILib components thread usage

Thanks for the information krieck. It's one less thing for our team to worry about. What about the command system? One would think that to run commands synchronously, they would be run in a seperate thread?

Last edited by Varriount : 29-01-2012 at 15:51.
Reply With Quote
  #6   Spotlight this post!  
Unread 29-01-2012, 16:12
Sunstroke Sunstroke is offline
Programmer
AKA: Joe Grinstead
FRC #3504 (Girls of Steel)
Team Role: Mentor
 
Join Date: Apr 2009
Rookie Year: 2009
Location: New England
Posts: 49
Sunstroke is an unknown quantity at this point
Re: Questions on WPILib components thread usage

Quote:
Originally Posted by Varriount View Post
Thanks for the information krieck. It's one less thing for our team to worry about. What about the command system? One would think that to run commands synchronously, they would be run in a seperate thread?
They are not, instead commands are just run in order in a single thread. Because of the iterative nature of commands though, this makes the run concurrently.

However, there is a downside because if one of your commands calls sleep or whatnot in its execute method, then all the other commands will have to wait for yours to finish before they do anything.
Reply With Quote
  #7   Spotlight this post!  
Unread 29-01-2012, 16:45
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,125
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Questions on WPILib components thread usage

Quote:
Originally Posted by Varriount View Post
Thanks for the information krieck. It's one less thing for our team to worry about. What about the command system? One would think that to run commands synchronously, they would be run in a seperate thread?
Did you mean concurrently?
Reply With Quote
  #8   Spotlight this post!  
Unread 29-01-2012, 16:47
Varriount Varriount is offline
Registered User
FRC #2421
 
Join Date: Jan 2012
Location: Virginia
Posts: 5
Varriount is an unknown quantity at this point
Re: Questions on WPILib components thread usage

Quote:
Originally Posted by Ether View Post
Did you mean concurrently?
Ah, yes, I did mean concurrently, sorry.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 00:40.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi