This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: A Boolean inside a subclass of a subclass of Thread is null when accessed from run().




On Thu, 25 Jan 2007, Per Bothner wrote:

Kjetil S. Matheussen wrote:
 Thanks! Changing to boolean fixed it. I didn't know about boolean. But I
 wonder something fishy may be going on anyway?

Yes. Your Java program is undefined. You're calling start from a Thread's constructor. Don't do that. In this case, you're creating a new thread in the super-class constructor, when then calls getData. At the "same time" the original thread returns from the superclass constructor, and continues the derived constructor, which means initializing the isplaying field. So it is undefined whether the isplaying field is set before or after it is accessed.


Great! Thank you very much for that explanation. I would probably never have figured out this on my own, instead I would probably just have added a bunch of hacks to work around the problem.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]