// @topic T11766 Multithreading -- wait-notify-interrupt example 02
// @brief class IOThread implements Runnable -- the worker thread

package mth;

public class IOThread implements Runnable {
    @Override
    public void run()
    {
        Thread ct = Thread.currentThread();
        System.out.println( "\t[" + ct.getName() + "] started" );
        try
        {
            for(;;) {
                synchronized( ct ) {
                    ct.wait();
                }
                System.out.println( "\t[" + ct.getName() + "] count==" + AppMain.count.getValue() );
            }
        }
        catch( InterruptedException ex )
        {
            System.out.println( "\t[" + ct.getName() + "] interrupted" );
        }

        System.out.println( "\t[" + ct.getName() + "] finished" );
    }
}//class IOThread