Run the following with green threads and you get only H's.  Run it with native
threads and you get H's mixed with L's


/**
 * threadtest.java
 *
 *
 * Created: Mon May  1 15:35:45 2000
 *
 * @author Joseph Shraibman
 * @version 1.0
 */

public class threadtest  {
    
    public threadtest() {}

    public Runnable getWT(String name){
        return new workThread(name);
    }

    class workThread implements Runnable{
        String name;
        public workThread(String n){name = n;}
        public void run(){
            //Thread.yield();
            while(true){
                System.out.print(name);
                System.out.flush();
            }
        }
    }

    public static void main(String[] args){

        threadtest tt = new threadtest();

        Thread t1 = new Thread(tt.getWT("H"));
        Thread t2 = new Thread(tt.getWT("L"));

        
        t2.setPriority( t2.getPriority() -1); 
        t2.start();
        t1.start();

    }

    
} // threadtest

____________________________________________________________________
Get your own FREE, personal Netscape WebMail account today at 
http://webmail.netscape.com.


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to