« Tech Support: Several outputs at once | Main | A Christmas tale »

Tech Support: Resource sharing

Rab asked:

In a Multi Tracking program with 4 Tasks and each task has the ability to turn on a (common) siren if in a trouble situation.

How can I disable the siren output for a period (say 20 min) from a input and have the siren reset and be ready to operate again after the 20 minute period?

Rab,

The problem here is that you have allowed 4 different tasks to "own" the siren, so control of the siren resource has become diffuse and hard to manage.

Try making a separate task to control the siren. It receives requests from it's "clients" (the 4 existing tasks) when they want an alert. The requests can be in the form of semaphores. The siren task then looks at the requests plus the inhibit input and decides what to do.

By doing this you will have separated the two aspects of the problem:

  1. Deciding that an alarm condition exists, and
  2. Sounding or muting the siren
from each other. This should make it easier to make the program do exactly what you want it to do. It will also make maintenance easier, so if you want to change the "rules" for sound or silence there will be no impact on how and when alarm conditions are generated.

TrackBack

TrackBack URL for this entry:
http://www.splatco.com/cgi-sys/cgiwrap/microcon/managed-mt/mt-tb.cgi/82

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)


About

This page contains a single entry from the blog posted on December 15, 2007 9:42 AM.

The previous post in this blog was Tech Support: Several outputs at once.

The next post in this blog is A Christmas tale.

Many more can be found on the main index page or by looking through the archives.

Creative Commons License
This weblog is licensed under a Creative Commons License.
Powered by
Movable Type 3.33