[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: hook question
- From: roberto@... (Roberto Ierusalimschy)
- Date: Mon, 16 Oct 2006 14:21:47 -0200
> Let A and B be two sig_atomic_t values, each initialised to 0.
>
> The reader of hook:
> repeat {
> read A
> read hook
> read B
> } until (A == B);
>
> The writer of hook:
> let C = B + 1
> B = C
> write hook
> A = C
>
> This works as long as the writer is called no more than 2^16 times
> between any read A and read B of a reader and as long as memory is
> ordered (which it is for all uniprocessor systems).
Are you sure? Can't the compiler (not the processor) delay the actual
access in "read hook" until it needs it? Or maybe we can solve this with
a non-voodoo volatile in "hook"?
-- Roberto
- References:
- Re: hook question, Glenn Maynard
- Re: hook question, Roberto Ierusalimschy
- Re: hook question, Glenn Maynard
- Re: hook question, Rici Lake
- Re: hook question, Glenn Maynard
- Re: hook question, Rici Lake
- Re: hook question, Glenn Maynard
- Re: hook question, Rici Lake
- Re: hook question, Roberto Ierusalimschy
- Re: hook question, David Jones