Discussion:
[boost] Atomic Shared Ptr
Olaf van der Spek via Boost
2017-06-16 12:31:59 UTC
Permalink
Hi,

Does Boost have anything like concurrency TS' atomic_shared_ptr?


Gr,
--
Olaf

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Peter Dimov via Boost
2017-06-16 12:42:56 UTC
Permalink
Post by Olaf van der Spek via Boost
Hi,
Does Boost have anything like concurrency TS' atomic_shared_ptr?
No, only http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2632.html

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Olaf van der Spek via Boost
2017-06-16 12:45:00 UTC
Permalink
On Fri, Jun 16, 2017 at 2:42 PM, Peter Dimov via Boost
Post by Peter Dimov via Boost
Post by Olaf van der Spek via Boost
Hi,
Does Boost have anything like concurrency TS' atomic_shared_ptr?
No, only http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2632.html
Any plans to add it?
IMO it'd be nice to have.
--
Olaf

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Peter Dimov via Boost
2017-06-16 15:39:15 UTC
Permalink
Post by Olaf van der Spek via Boost
On Fri, Jun 16, 2017 at 2:42 PM, Peter Dimov via Boost
Post by Peter Dimov via Boost
Post by Olaf van der Spek via Boost
Hi,
Does Boost have anything like concurrency TS' atomic_shared_ptr?
No, only
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2632.html
Any plans to add it?
IMO it'd be nice to have.
Sure, why not.

https://github.com/boostorg/smart_ptr/commit/2964ed2379cf47778b18954b8d3501fa940c8754


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Gottlob Frege via Boost
2017-06-17 20:35:15 UTC
Permalink
On Fri, Jun 16, 2017 at 11:39 AM, Peter Dimov via Boost
Post by Peter Dimov via Boost
Post by Olaf van der Spek via Boost
On Fri, Jun 16, 2017 at 2:42 PM, Peter Dimov via Boost
Post by Olaf van der Spek via Boost
Hi,
Does Boost have anything like concurrency TS' atomic_shared_ptr?
No, only >
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2632.html
Any plans to add it?
IMO it'd be nice to have.
Sure, why not.
https://github.com/boostorg/smart_ptr/commit/2964ed2379cf47778b18954b8d3501fa940c8754
I have enormous faith in you, however, this is the simplest
implementation I've seen. I assume that is because it is not
lock-free? Or is it because it doesn't actually work?

Tony

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Peter Dimov via Boost
2017-06-17 20:49:30 UTC
Permalink
Post by Peter Dimov via Boost
https://github.com/boostorg/smart_ptr/commit/2964ed2379cf47778b18954b8d3501fa940c8754
I have enormous faith in you, however, this is the simplest implementation
I've seen. I assume that is because it is not lock-free? Or is it
because it doesn't actually work?
I made it a bit more complex:

https://github.com/boostorg/smart_ptr/commit/67d897a5330e99821adcebc82f605dd1d62b4fde

The reason it was so simple was because it was using the already existing
atomic functions. And no, it's not lock-free. Lock-freedom requires
significantly more complexity (and a double-width CAS).


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Olaf van der Spek via Boost
2017-06-19 06:51:08 UTC
Permalink
On Sat, Jun 17, 2017 at 10:49 PM, Peter Dimov via Boost
Hi Peter,

Wow, that was fast. Thanks!
Post by Peter Dimov via Boost
The reason it was so simple was because it was using the already existing
atomic functions. And no, it's not lock-free. Lock-freedom requires
significantly more complexity (and a double-width CAS).
Why not improve the existing functions and keep using those?
--
Olaf

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Peter Dimov via Boost
2017-06-19 12:16:18 UTC
Permalink
Post by Olaf van der Spek via Boost
On Sat, Jun 17, 2017 at 10:49 PM, Peter Dimov via Boost
Hi Peter,
Wow, that was fast. Thanks!
You're welcome. :-)
Post by Olaf van der Spek via Boost
Post by Peter Dimov via Boost
The reason it was so simple was because it was using the already
existing atomic functions. And no, it's not lock-free. Lock-freedom
requires significantly more complexity (and a double-width CAS).
Why not improve the existing functions and keep using those?
Since atomic_shared_ptr is a separate type, there's room for it for a
spinlock, which on balance is a bit better than using a separate spinlock
pool as the free functions do.


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Loading...