digitalmars.D.learn - Is there a thread safe single linked list?
- denizzzka (3/3) Oct 12 2012 Hi!
- denizzzka (1/1) Oct 12 2012 or dynamic array with this methods
- Jonathan M Davis (7/11) Oct 12 2012 Not in Phobos. No containers in Phobos contain any kind of synchronizati...
- denizzzka (8/8) Oct 12 2012 Thanks for answer!
- denizzzka (2/4) Oct 12 2012 Ok, this is a good opportunity to learn how to write such by
- Sean Kelly (8/13) Oct 12 2012 synchronized-based solution. I am need compare-and-swap single linked =
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 =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.=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: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.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
Oct 13 2012
Not that the "titanic" but the authors, probably, have used Java and another type of cas result returns.
Oct 13 2012