Re: Global Variable Safety with Multi-tasking

new topic     » goto parent     » topic index » view thread      » older message » newer message

The solution for this kind of problem has already been established in the network model,where a variable or an element of a database is locked. If you want to use a global variable sequence in a task that is likely to be dynamically changed by another task, a good solution would be to look ahead at one or two elements (depending upon the likelihood of them being changed,) and use the appropriate one for your program.

Let us say, your loop is working with the 4th element of the sequence.
Instead of just picking up the fourth element, you picking it up from the stored one when you were doing the 3rd element, compare with the current, do a condition decision which one you will use and at the same time time you also store the value of the 5th and 6th element.

It will all depend upon what the interfering task is likely to do to the elements of a sequence.

Just my two pence worth.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu