Thread overview | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
October 12, 2012 Is there a thread safe single linked list? | ||||
---|---|---|---|---|
| ||||
Hi! Specifically, pushBack(x) and moveFront() operations should be a thread safe. |
October 12, 2012 Re: Is there a thread safe single linked list? | ||||
---|---|---|---|---|
| ||||
Posted in reply to denizzzka | or dynamic array with this methods |
October 12, 2012 Re: Is there a thread safe single linked list? | ||||
---|---|---|---|---|
| ||||
Posted in reply to denizzzka | 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
|
October 12, 2012 Re: Is there a thread safe single linked list? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | 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() |
October 12, 2012 Re: Is there a thread safe single linked list? | ||||
---|---|---|---|---|
| ||||
Posted in reply to denizzzka | > 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 :-)
|
October 12, 2012 Re: Is there a thread safe single linked list? | ||||
---|---|---|---|---|
| ||||
Posted in reply to denizzzka | On Oct 12, 2012, at 10:18 AM, denizzzka <4denizzz@gmail.com> wrote: > 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() There's a sample Stack and SList implementation in the concurrency chapter: http://www.informit.com/articles/printerfriendly.aspx?p=1609144 |
October 13, 2012 Re: Is there a thread safe single linked list? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean Kelly | 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.
|
Copyright © 1999-2021 by the D Language Foundation