11/18/2012 8:46 AM, Jonathan M Davis пишет:
I don't know if we can answer this for sure at the moment given the ongoing
discussion on shared, but looking at core.sync, it occurred to me that there's
a major problem with the classes in there. None of the work with shared. And
unless I'm missing something here, I don't see how many of them are even
useful as anything other than shared. After all, what good is a mutex which is
thread-local? But none of the methods on Mutex or its friends are shared.


None of them are useful without shared.They should work with shared, but that'll break code outright. I think 2 overloads per method with TLS versions going through the deprecation path.

So, the question is should the all have their methods shared? And if they
should, is there any reason to have non-shared overloads for them? What good
are they as anything other than shared? How is anyone using them right now?

I do suspect that most people use _gshared with them as it is the less painful way. Another way is to have them shared and cast them to TLS as needed. Since mutex, condition etc. are opaque types around OS primitives TLS doesn't make sense at all but currently allows to call their methods.

--
Dmitry Olshansky

Reply via email to