On Sun, Jan 06, 2013 at 05:43:06PM +0700, Henrik Sarvell wrote:
> > Yes, but the caching issue is not resolved. If two processes increment
> ...
> I'm not sure I follow you with that, when I do my testing with the
> following code:
> ...
>             (do 10
>                (inc> U 'balance 10)
>                (commit 'upd)
>                (link (; U balance))
>                (wait 2000) ) ) ) ) )
> ...
> I get (110 120 120 130 140 150 160 170 180 190) as the result of
> ...
> Seems to me that incRepeat gets the decrease alright?

This works because 'wait' is an idle loop, which also synchronizes in
the background.

Try a busy loop like (do 10000000) instead. Then the above code will
happily increment the local balance, no matter how much other processes
decrement the value in the meantime.


'sync' uses the internal mechanisms of 'wait', but in addition to that
also addresses the issue of race conditions, which are difficult to
reproduce with your setup. 'sync' guarantees that notifications about
changes done by one process are sent _atomically_ to all other
processes.

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to