View unanswered posts | View active topics It is currently Fri Oct 24, 2014 10:55 pm






Reply to topic  [ 2 posts ] 
What is a Task? 
Author Message
Rookie

Joined: Tue Feb 14, 2012 2:38 am
Posts: 1
Post What is a Task?
What is the equivalent of a task in C? A thread, process, or something else? Do they share global variables? This question has likely been answered but I can't find it.


Tue Feb 14, 2012 2:42 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3227
Location: Rotterdam, The Netherlands
Post Re: What is a Task?
A task is an independently piece of running code inside a program. So its closest equivalent would be a light-weight thread. Threads share the same global variable space. You always have at least one task in your program called "main". You cannot pass variables to a task initialisation. Also, you must realise that functions in ROBOTC are not re-entrant, that means you can't call the same function from two tasks at the same time without mangling the variables. There is a mutex "API" though that will allow you to work around that.

- Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Tue Feb 14, 2012 2:54 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.