Java2D III
Bruno Medeiros
brunodomedeirosATgmail at SPAM.com
Thu Aug 3 08:42:14 PDT 2006
xs0 wrote:
> BLS wrote:
>> tokenNames[LITERAL_synchronized]="synchronized";
>
> when used with an expression, it's the same as in D, but can also be a
> modifier for functions. With non-static methods,
>
> synchronized func()
> {
> }
>
> becomes
>
> func()
> {
> synchronized(this) {
> }
> }
>
Actually, that Java code can be converted directly to D, as D support
synchronized methos. And yes it's not clearly documented, the only
reference to that is in: http://www.digitalmars.com/d/overview.html,
Synchronization.
> With static methods, its synchronized(ClassName.class) in Java, I'm not
> sure whether something similar can be used in D (is TypeInfo an object
> or a struct?)
>
It also works with static methods in D. It is synchronized on
this.classinfo , which is the equivalent of Java's ClassName.class .
--
Bruno Medeiros - MSc in CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
More information about the Digitalmars-d-announce
mailing list