/ ************************************************** *****************************************
*
* CopyRight (C) 2004 Ming Run.
*
* This Software Is Provided 'As-Is', WithOout Any Express or Implied Warranty. In no
* Event will the authors be held liable for any damages arising from the use of this
* Software.
*
* Permission is granted to anyone to use this software for any purpose, including
* Commercial Applications, And to ALTER IT and Redistribute It Free, Subject To The
* FOLLOWING RESTRICTIONS:
*
* 1. The Origin of this Software Must Not Be misrepreprepreprepreprepreted; you must not claim That
* You Wrote the Original Software. if you use this software in a product, an
* Acknowledgment (See the Following) In The Product Documentation is Required.
*
* CopyRight (C) 2004 Ming Run.
*
* 2. Altered Source Versions Must Be Plainly Marked As Such, And Must Not Be
* Misrepresented as being the original software.
*
* 3. This Notice May Not Be Removed or Altered from Any Source Distribution.
*
*********************************************************** ******************************* /
/ *
* Compile Sample:
* JSC / T: EXE /OUT :THReading.exe threading.js
* /
//
// USING DIRECTIVES
//
Import system;
Import system.threading;
Import system.windows.forms;
// THREAD
Var thethread: WriteconsoleThread = new writeconsolethread ();
// Standard Thread
Application.run (new form ());
// stop the thread
THREAD.STOPTHREAD = TRUE;
// Thread Runner Class
Class WriteconsoleThread
{
// Thread Start
Private Var ThreadStart: threadstart;
// thread
Public var singlethread: thread;
// stop flag
Public var stopthread: boolean;
// conncture
Public Function WriteconsoleThread ()
{
THIS.STOPTHREAD = false; this.threadstart = printdot;
This.singLethread = New Thread (this.threadstart);
THIS.SINGLETHREAD.START ();
}
// Print '.' To console screen
Private function printdot ()
{
While (! this.stopthread)
{
Console.write (".");
Thread.sleep (1000);
}
Console.writeline ("");
Console.write ("Stopping Thread ...");
THIS.SINGLETHREAD.ABORT ();
}
}