shared - i need it to be useful
Nicholas Wilson
iamthewilsonator at hotmail.com
Tue Oct 16 22:24:26 UTC 2018
On Tuesday, 16 October 2018 at 21:19:26 UTC, Steven Schveighoffer
wrote:
> OK, so here is where I think I misunderstood your point. When
> you said a lock-free queue would be unusable if it wasn't
> shared, I thought you meant it would be unusable if we didn't
> allow the implicit cast. But I realize now, you meant you
> should be able to use a lock-free queue without it being
> actually shared anywhere.
>
> What I say to this is that it doesn't need to be usable. I
> don't care to use a lock-free queue in a thread-local capacity.
> I'll just use a normal queue, which is easy to implement, and
> doesn't have to worry about race conditions or using atomics. A
> lock free queue is a special thing, very difficult to get
> right, and only really necessary if you are going to share it.
> And used for performance reasons!
I think this comes up where the queue was originally shared, you
acquired a lock on the thing it is a member of, and you want to
continue using it through your exclusive reference.
More information about the Digitalmars-d
mailing list