is core Mutex lock "fast"?
Steven Schveighoffer
schveiguy at gmail.com
Tue Jan 26 22:35:11 UTC 2021
On 1/26/21 4:40 PM, ludo wrote:
>> However, I think this is all moot, druntime is the same as Tango.
>
> Moot you mean debatable? Or irrelevant :)
I *think* it's irrelevant. The comment makes it sound like it's slightly
different than Tango, but for sure reentrant locks are possible with D2
phobos. I am *100% sure* that druntime is from Tango, because I was
there when it was a controversy and this was the solution.
> Thanks to your explanations, I
> understand now that the dev tried to imitate a Tango feature with very
> old D1 code. This is 2005/2009 code
>
> And as pointed out by IGotD-, better not to mess around with synch /
> reinvent the wheel. I will trash this class. Still learning a lot, thank
> you guys.
Yes, I agree. I'm no expert on thread atomics, but I know enough to know
I shouldn't mess with the tried-and-true primitives that are generally used.
Consider that very very smart people have tried to write "lock free"
stuff and commonly fail (and some dumb people, including me). And when
you fail here, it's not a failure you see immediately, because it may
happen once in a blue moon.
Performance is irrelevant if it's not correct.
-Steve
More information about the Digitalmars-d-learn
mailing list