|
Page 1 of 1
|
[ 2 posts ] |
|
| Author |
Message |
|
jballen92
Rookie
Joined: Tue Feb 14, 2012 2:38 am Posts: 1
|
 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 |
|
 |
|
mightor
Moderator
Joined: Wed Mar 05, 2008 8:14 am Posts: 2858 Location: Rotterdam, The Netherlands
|
 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
_________________| Some people, when confronted with a problem, think, "I know, I'll use threads," | and then two they hav erpoblesms. (@nedbat)| My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
| Tue Feb 14, 2012 2:54 am |
|
|
|
Page 1 of 1
|
[ 2 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 1 guest |
|
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
|
|