home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1997 October
/
Chip_1997-10_cd.bin
/
tema
/
sybase
/
powerj
/
samples.z
/
CounterThread.wxc
< prev
next >
Wrap
Text File
|
1997-01-28
|
2KB
|
115 lines
Save Format v2.0(1)
@begin ClassFile "CounterThread"
Exported 1;
Abstract 0;
Interface 0;
PackageName "";
Language "Java";
@begin UserFunction "CounterThread(threads2 parent)"
GencodeSrcLine 10;
FunctionName "CounterThread::CounterThread(threads2 parent)";
@end;
@begin UserFunction "Prototype for CounterThread(threads2 parent)"
Private 1;
GencodeSrcLine -1;
FunctionName "CounterThread::Prototype for CounterThread(threads2 parent)";
@end;
@begin UserFunction "run()"
GencodeSrcLine 23;
FunctionName "CounterThread::run()";
@end;
@begin UserFunction "Prototype for run()"
Private 1;
GencodeSrcLine -1;
FunctionName "CounterThread::Prototype for run()";
@end;
@begin HPPPrefixBlock
@begin-code HPPPrefix
// add your custom import statements here
@end-code;
GencodeSrcLine 6;
@end;
@begin ClassContentsBlock
@begin-code ClassContents
// add your data members here
Form1 _parent;
int _threadNumber;
int _counter = 0;
@end-code;
GencodeSrcLine 38;
@end;
@begin-code BaseClassList
extends Thread
@end-code;
@begin-code GeneratedClassContents
@end-code;
@begin-code Code "CounterThread::CounterThread(threads2 parent)"
/******************************
/**
* This class constructs the counting threads.
* The thread counts from 0 to 1000 (then rolls over) and
* displays the count value on the parent form.
*/
public @CLASSNAME@(Form1 parent, int threadNumber)
//********************************
{
_parent = parent;
_threadNumber = threadNumber;
}
@end-code;
@begin-code Code "CounterThread::Prototype for CounterThread(threads2 parent)"
public:
@@CLASSNAME@(threads2 parent);
@end-code;
@begin-code Code "CounterThread::run()"
public void run()
//********************************
{
while (true)
{
_counter = _counter + 1;
if (_counter > 1000)
_counter = 0;
synchronized (this)
{
_parent.setCounter(_threadNumber, _counter);
}
}
}
@end-code;
@begin-code Code "CounterThread::Prototype for run()"
public:
void run();
@end-code;
@end;