[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

RE: [JAVA] Multithreading i java applikationer?



> Er der nogen på denne liste der har forstand på multithreading?
> Det jeg gerne ville have var en thread på en funktion og ikke en hel
> klasse.
> kan det lade sig gøre?

Nej, det går inte.

Är du säker på att det inte är bättre att använda en klass? Hittils har jag då
aldrig stätt på en situation där jag velat ha enbart en funktion att exekvera i
en tråd.

Kom ihåg att du kan göra en inner-klass som tråd. Så om du vill exekvera
MyClass.doSomething() i en annan tråd, kan du helt enkelt, i en metod i MyClass,
skriva:

(new Thread()
        {
                public void run()
                {
                        doSomething();
                }
        }).start();

/ Peter Schuller
----------------
E-Mail: sslug@sslug
Web: http://hem.passagen.se/petersch



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 19:03 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *