Hi,

On Sun, Sep 15, 2019 at 2:24 AM Vitaly Davidovich <vita...@gmail.com> wrote:
> In your snippet, terminate() sets the field - it can be visible immediately 
> (or terminate() thread is descheduled).  decrement runs, decrements to 0, 
> sees action != null.  terminate() also now sees 0, and likewise proceeds to 
> run the action.
>
> The AR I was suggesting would allow ownership protocol over the action.  Read 
> it, if not null, try to CAS a null in there.  If CAS succeeds, you’ve claimed 
> ownership.  If it fails, someone else claimed it.  Whoever claims it runs the 
> action.

I see, thanks!

-- 
Simone Bordet
---
Finally, no matter how good the architecture and design are,
to deliver bug-free software with optimal performance and reliability,
the implementation technique must be flawless.   Victoria Livschitz

-- 
You received this message because you are subscribed to the Google Groups 
"mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mechanical-sympathy+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/mechanical-sympathy/CAFWmRJ1o9FM0wbNm5TWk_wzR59RCevgBxoM9%3D4L%3DEtO3VmtSFw%40mail.gmail.com.

Reply via email to