This is the mail archive of the
crossgcc@cygnus.com
mailing list for the crossgcc project.
Re: Atomic Operations (continuing on from Masking Interrupts?)
"Robert J. Brown" wrote:
>
>
> The problem is that there is no language enforced way to insure that
> enables are balanced with disables, and inhibits are balanced with
> restores. The use of a subroutine that takes a thunk as its sole
> argument, such as my "without_pre_emption(thunk)" example above,
> forces the programmer to keep things balanced. The only real
> trouble-maker is throwing an exception, or taking a longjump. Lisp
> provides "unwind-protect" for that situation.
Use C++. Create a classlet where the constructor saves the interrupt
mask and disables interrupts, and the destructor restores the status quo
ante. Create one of these on the stack; when it goes out of scope
interrupts are restored.
Of course you then suffer the perils of C++, but that's another story
;-)
HTH!
Luke Diamand
--
Virata http://www.virata.com
Cambridge
Tel: +44 1223 566919 Fax: +44 1223 566915
_______________________________________________
New CrossGCC FAQ: http://www.objsw.com/CrossGCC
_______________________________________________
To remove yourself from the crossgcc list, send
mail to crossgcc-request@cygnus.com with the
text 'unsubscribe' (without the quotes) in the
body of the message.