Pumpkin, Inc.

Pumpkin User Forums

Global Variables??

If you can't make Salvo do what you want it to do, post it here.

Global Variables??

Postby kiddster » Sun Oct 07, 2001 5:54 am

I have current have a task that updates a counter at regular intervals. What I'd like to do is have two other tasks that can access the counter. One would be able to set the counter to any value and the other would read the current value in the counter. I want the update counter task to function independently of these two other tasks. Would it be best to have a global variable that each task affects, or is their some creative way to pass messages between the tasks?
kiddster
 
Posts: 5
Joined: Fri Sep 21, 2001 11:00 pm

Re: Global Variables??

Postby aek » Sun Oct 07, 2001 8:01 am

From what you describe, it may make more sense to simply treat it as a global variable.

quote:
One would be able to set the counter to any value and the other would read the current value in the counter.

The way I read this, there's no need for either of these tasks to i) do anything periodic, ii) wait on anything, or iii) run with a priority, etc. So I don't see the utility of making these into tasks -- they probably should be simple functions instead.

Time is usually a "global concept" in a system, so compartmentalizing it inside a task may not be such a good idea.

------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm


Return to Coding

Who is online

Users browsing this forum: No registered users and 1 guest

cron