August 03, 2006 Re: Java2D III | ||||
---|---|---|---|---|
| ||||
Posted in reply to xs0 | 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 |
Copyright © 1999-2021 by the D Language Foundation