digitalmars.D.learn - Is there a thread safe single linked list?
- "denizzzka" <4denizzz gmail.com> Oct 12 2012
- "denizzzka" <4denizzz gmail.com> Oct 12 2012
- "Jonathan M Davis" <jmdavisProg gmx.com> Oct 12 2012
- "denizzzka" <4denizzz gmail.com> Oct 12 2012
- "denizzzka" <4denizzz gmail.com> Oct 12 2012
- Sean Kelly <sean invisibleduck.org> Oct 12 2012
- "denizzzka" <4denizzz gmail.com> Oct 13 2012
- "denizzzka" <4denizzz gmail.com> Oct 13 2012
Hi! Specifically, pushBack(x) and moveFront() operations should be a thread safe.
Oct 12 2012
On Friday, October 12, 2012 14:59:56 denizzzka wrote:Hi! Specifically, pushBack(x) and moveFront() operations should be a thread safe.
Not in Phobos. No containers in Phobos contain any kind of synchronization. The same goes for the built-in array types. If any of them are shared, you'll need to protect them appropriately. If any kind of thread-safe container exists, it's in a third party library somewhere. - Jonathan M Davis
Oct 12 2012
Thanks for answer! After investigation came to the conclusion that here is needed not synchronized-based solution. I am need compare-and-swap single linked list because it will be used in callback proc from C, and it cannot be throwable, but synchronized contains throwable _d_monitorenter and_d_monitorexit. I would be grateful if someone share singly linked list based on cas()
Oct 12 2012
I would be grateful if someone share singly linked list based on cas()
Ok, this is a good opportunity to learn how to write such by oneself :-)
Oct 12 2012
On Oct 12, 2012, at 10:18 AM, denizzzka <4denizzz gmail.com> wrote:Thanks for answer! =20 After investigation came to the conclusion that here is needed not =
list because it will be used in callback proc from C, and it cannot be = throwable, but synchronized contains throwable _d_monitorenter = and_d_monitorexit.=20 I would be grateful if someone share singly linked list based on cas()
There's a sample Stack and SList implementation in the concurrency = chapter: http://www.informit.com/articles/printerfriendly.aspx?p=3D1609144
Oct 12 2012
On Friday, 12 October 2012 at 23:30:39 UTC, Sean Kelly wrote:I would be grateful if someone share singly linked list based on cas()
There's a sample Stack and SList implementation in the concurrency chapter: http://www.informit.com/articles/printerfriendly.aspx?p=1609144
Of course, I read this article. I think that SList is not the same thing as FIFO list - get the first entry in the queue and get queue entry by numerical order are two different things in multithreaded environment, right? I think its necessary to implement "primitives" like a CASN from article "A Pratial Multi-Word Compare-and-Swap Operation" (by Timothy L. Harris, Keir Fraser and Ian A. Pratt.) This titanic challenge as I see it, but sooner or later it will have to do. Then we will be able to create various thread safe structures.
Oct 13 2012
Not that the "titanic" but the authors, probably, have used Java and another type of cas result returns.
Oct 13 2012









"denizzzka" <4denizzz gmail.com> 