🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Unique Thread for each methods

#7854
From: ArShAm
Date: Fri, 18 May 2001 19:23
61 lines
1864 bytes
Thanks
But I found a way to do that :

public class myClass extends Thread // and for implementing Runnable
{
    ......
    Thread M1,M2,M3,M4; //  M1 for method1 , M2 for method2 ,etc.
     M1=new Thread(this);
     M1.start();

     M2=new Thread(this);
     M2.start();

     M3=new Thread(this);
     M3.start();

     M4=new Thread(this);
     M4.start();

    public void run()
    {
        Thread currentlyThread=Thread.currentThread();
        while(currentlyThread==M1)
        {
            method1();
        }
        while(currentlyThread==M2)
        {
            method2();
        }
........
    }


.....
    public void method1()
    {
    .....
    }

    public void method2()
    {
    .....
    }

    public void method3()
    {
    .....
    }

    public void method4()
    {
    .....
    }
    .........
}


Regards
    ArShAm
Technical Details
Message-ID: <3b057b2f_1@dnews>
Path: arc1-ca.pugleaf.net!archiver1.sj.google.com!newsfeed.google.com!sn-xit-03!supernews.com!newsfeed.wirehub.nl!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews
References: <3b02850a$1_2@dnews> <3B041778.1F1130E8@foremail.nospamplease>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,d62c14e6e0c1b82e
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-05-18 13:23:54 PST
Reply-To: "ArShAm" <ArShAm@abshar.net>
From: "ArShAm" <ArShAm@abshar.net>
Newsgroups: borland.public.jbuilder.java.language
References: <3b02850a$1_2@dnews> <3B041778.1F1130E8@foremail.nospamplease>
Subject: Re: Unique Thread for each methods
Date: Fri, 18 May 2001 23:53:04 +0430
Lines: 63
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6700
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700
NNTP-Posting-Host: 61.11.252.154
Message-ID: <3b057b2f_1@dnews>
X-Trace: dnews 990214959 61.11.252.154 (18 May 2001 12:42:39 -0700)
Path: arc1-ca.pugleaf.net!archiver1.sj.google.com!newsfeed.google.com!sn-xit-03!supernews.com!newsfeed.wirehub.nl!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews