Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2000-08-31 23:47:03


----- Original Message -----
From: "Valentin Bonnard" <Bonnard.V_at_[hidden]>

> Insert in singly linked list:
>
> inserted->next = pos->next;
> pos->next = inserted;
>
> This can't be done atomically, even which get_and_set (but each assignment
> can be done atomically)
>
>
> Remove from singly linked list:
>
> // at this point removed_prev.next == removed
> removed_prev->next = removed->next;
>
> MOVE (next,removed), (next,removed_prev)
>
> (Atomic on every 68k)
>
>
> Remove from doubly linked list:
>
> removed->prev->next = removed->next;
> removed->next->prev = removed->prev;
>
> IMO this can't be done atomically (but each assignment can be done
> atomically).
>
>
> The 68000 also has CAS:
>
> if (*p == v)
> *p = u;
> else
> v = *p;
>
> that I have used to implement a lock.

I was talking about 68020 and above. Those have at least got a CAS2
instruction.
"
a.. Double compare and swap (DCAS or CAS2) atomically performs if (*t1==v1
&& *t2==v2) { *t1=u1; *t2=u2; } where t1 and t2 are TSM "
a..
Here is a reference:
http://mosquitonet.stanford.edu/~fox/SUMMARIES/osstruc/nbs.html
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk