Article View: borland.public.jbuilder.java.language
Article #18080Re: Thread question
From: Steve Horsley
Date: Tue, 18 Aug 1998 00:00
Date: Tue, 18 Aug 1998 00:00
38 lines
1876 bytes
1876 bytes
Simon Andersson wrote: > > Hi. > > Before I execute a query in a QueryDataSet I start a thread to do some > picture animations while the program is fetching data from the database. > > The problem is that nothing happens. I know that the animation work itself > but it seems like the thread is stopped or something while the query gets > executed. Is that the case? I even tried to give it MAX_PRIORITY. > > Someone knows anything about this? > > TIA / Simon I'm new to Java, so I could be wrong about this - have a think about it though. If ayone can confirm what I'm saying, I'd like to know. With C++Builder, the main() thread is the one that handles all the screen updates, processing repaint messages etc. when it is idle. If a second thread changes something that causes a visible change, this change only gets repainted once the main thread is idle. I found this out the hard way. The secret is to make sure the main() thread is never involved in any lengthy work - always create other threads to do the slow work. I am guessing that maybe the same is true in Java, in which case you really want a third thread to do your query, leaving the original thread to process screen repaints etc. while the second thread does pretty animations. Regards, Steve.
Technical Details
Message-ID:
<35D941CF.4262@cwcom.co.uk>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<6qc7vq$evf3@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,ee1311dc64d2e969 X-Google-Attributes: gidf74b3,public From: Steve Horsley <steve.horsley@cwcom.co.uk> Subject: Re: Thread question Date: 1998/08/18 Message-ID: <35D941CF.4262@cwcom.co.uk> X-Deja-AN: 382226585 Content-Transfer-Encoding: 7bit References: <6qc7vq$evf3@forums.borland.com> Content-Type: text/plain; charset=us-ascii Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Reply-To: steve.horsley@cwcom.co.uk Newsgroups: borland.public.jbuilder.java.language