Difference between __gshared and shared.
Jonathan M Davis via Digitalmars-d
digitalmars-d at puremagic.com
Wed Jul 8 11:28:03 PDT 2015
On Wednesday, 8 July 2015 at 18:05:13 UTC, Dmitry Olshansky wrote:
> I definetly seen synchronized classes in TDPL years ago. They
> ought to work today or am I missing something?
They're described in TDPL, but they've never been implemented.
Instead, we have synchronized functions like in Java (which TDPL
specifically talks about being a bad idea). With a synchronized
class, _all_ functions in a class would be synchronized, and a
variety of restrictions are placed on the class so that it can
make implicitly remove the outer layed or shared on its member
variables inside its member functions. With synchronized
functions, all they do is lock when you enter them an unlock when
you exit them and share the mutex with the other synchronized
functions in the class, but they add no other abilities or
guarantees.
So, arguably, we should implement synchronized classes as
described in TDPL, and that would certainly help with the shared
situation, but for whatever reason, no one has ever implemented
them.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list