🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #18113

Re: Current Thread

#18113
From: Jim Rudnicki
Date: Fri, 07 Aug 1998 00:00
24 lines
1531 bytes
RED MACPHERSON wrote in message ...
>Can you get a reference to your running thread from any point in an
>application? I would like to sleep(100) but I don't have access to my
>thread, or do I?

I would opine that if you don't know what thread is running, then you should
not be sleep()ing.  I'm guessing that you are trying to sleep in a message
or event handler.  While you may be able to retrieve a reference to the
event dispatch thread, it isn't best form to put this thread to sleep.  To
keep the user interface alive, you should handle and return quickly.

I realize you're only looking for a fraction of a second. But in general, if
it seems you can't do something maybe you shouldn't be doing it.  Then
again, sometimes I don't know whether I can't do something, or don't know
how to do something....hmmm.

So I suspect a good design would be to create and start a runnable object.
In that object perform the functions that occur before and after the sleep.
Keep the user interface alive.

nite

Jim
Technical Details
Message-ID: <6qeb0s$h065@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <MPG.10316000d547b109989680@forums.inprise.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,dab2837517ebda6
X-Google-Attributes: gidf74b3,public
From: "Jim Rudnicki" <rudnicki@best.com>
Subject: Re: Current Thread
Date: 1998/08/07
Message-ID: <6qeb0s$h065@forums.borland.com>
X-Deja-AN: 378775585
References: <MPG.10316000d547b109989680@forums.inprise.com>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.language