Application always in running
#1
Posted 17 September 2010 - 07:04 PM
Paolo Patierno
Microsoft MVP on Windows Embedded & IoT
Azure Advisor
Twitter : @ppatierno
Linkedin : paolopatierno
Blog : DevExperience
Blog : Embedded101
?
#2
Posted 17 September 2010 - 07:52 PM
#3
Posted 17 September 2010 - 08:20 PM
#4
Posted 18 September 2010 - 10:36 AM
What I do is write all my code in separate classes out of Program.cs with one class being the central unit, then I declare a static variable in Program.cs of the type of my central unit class, instantiate the variable in Main() and at that point the central unit class will handle everything and I use Thread.Sleep(-1); at the end.
Its wasteful to lock the Main() method in an endless loop, even if it does nothing.
Your is only a different design solution and I agree with you but the functionality is the same.
I won't use while loop because in this way the cpu load is always 100%.
I have understood that with the statement Thread.Sleep(-1) at the end of the Main() method, the process is active but the main thread sleeps forever but the event handlers (for example for InterruptPort) are active to catch events.
Is it right ?
Thanks,
Paolo
Paolo Patierno
Microsoft MVP on Windows Embedded & IoT
Azure Advisor
Twitter : @ppatierno
Linkedin : paolopatierno
Blog : DevExperience
Blog : Embedded101
?
#5
Posted 18 September 2010 - 11:34 AM
Today LED's, tomorrow, the world!!! Well, OK, maybe servos.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users