J
Jason (Kusanagihk)
To all,
I have written a SerialPort class / application using C# and .Net
Framework 3.0.
but I have a question; since my serialPort class / application is not
a Windows Form application (rather it is just a console program);
therefore I need a way to make the application "alive" until I kill
the application or enter a "quit" signal through the serial port.
I have tried the simplest way to make the app "alive" by using a
"while (true)" loop; but of course, the result is not good since a
"while(true)" loop will consume 100% cpu processing and slow down the
PC too.
So are there any other ways to keep a console app "alive" and not
consuming the cpu 100%? I am thinking if a Thread might help, but I
have no idea how... Also I was thinking, there must be some techniques
to make an app "alive" and won't consume cpu time just like a Windows
Form did (ie. it only consumes cpu processing power when there are any
user events or system events)
Any help would be appreciated
From Jason (Kusanagihk)
I have written a SerialPort class / application using C# and .Net
Framework 3.0.
but I have a question; since my serialPort class / application is not
a Windows Form application (rather it is just a console program);
therefore I need a way to make the application "alive" until I kill
the application or enter a "quit" signal through the serial port.
I have tried the simplest way to make the app "alive" by using a
"while (true)" loop; but of course, the result is not good since a
"while(true)" loop will consume 100% cpu processing and slow down the
PC too.
So are there any other ways to keep a console app "alive" and not
consuming the cpu 100%? I am thinking if a Thread might help, but I
have no idea how... Also I was thinking, there must be some techniques
to make an app "alive" and won't consume cpu time just like a Windows
Form did (ie. it only consumes cpu processing power when there are any
user events or system events)
Any help would be appreciated
From Jason (Kusanagihk)