I have beentrying to think of a way to do this for ages and am slowly going mad.
I have a filtering engine that scans the entered message for disallowed words. THe filter can be enabled or disabled and its state is recorded internally in a variable scannerStatus as either 0 or 1. For error handling i want to include an auto-recover should this variable become corrupt (as the scanner will have an unkown state) as this is network software security and error systems are paramount.
I can detect if the scannerStatus has an errounous value - but if it does i want to auto-correct it to the last state, so i need to record the state as it changes, if i simply copy it - the copy will become corrupt as well as the original - so thats no help. is tere a way of 'locking' a variable and then 'unlocking' when i wish to access it. Storing it in a text file seems a little ineffcient and it is possible it may become overwritten with corrupt value.