On Tuesday, 8 January 2013 06:00:26 UTC, ScannerPrincess wrote: > > On 01/07/2013 07:34 PM, Alun wrote: > What about disabling interrupts in the mainline code, making > a copy of the variable and then enabling interrupts again? > Working with the copy should be safe ... > > Greetings, Karin > > Isn't there then a risk missing an interrupt? I'm not sure about this, but if we turn off interrupts I don't think they'd queue until turned back on.
Last night, I thrashed out what I think is a "thread safe variable" library, but getting all the corner cases made it huge (costing at least 300 words) and when I wrote a test case for it I realised it provided no way of safely incrementing a variable! So I'm coming to the conclusion that a general solution isn't practical. As part of doing that, though, I *did* write routines for acquiring a lock atomically. I need to do some testing, but will probably submit that instead. Cheers, Alun. -- You received this message because you are subscribed to the Google Groups "jallib" group. To view this discussion on the web visit https://groups.google.com/d/msg/jallib/-/4FVA9z8J3GQJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/jallib?hl=en.
