Main Site Documentation

"WARN: Total initialization" every ten seconds


#1

I am not using an endless while loop but keep receiving the message:
WARN: Total initialization time exceeds 100 seconds.
: ProgramStarted is blocking execution, which means events and timers will not run properly.
: Make sure not to use blocking code such as while(true) - use a GT.Timer instead."
which shows every ten seconds.
This interferes with my debugging. Can I turn it off?
Many thanks,
Kevin.


#2

The reason it’s telling you this is that you’re doing what it says not to do. You need to let the ProgramStarted() method complete.

You may not get accurate program execution if you don’t let this finish, as there are Gadgeteer specific components that only get finalized after ProgramStarted() completes.

You mention you’re not using an endless loop, can you show us what you do actually do in ProgramStarted() ?


#3

Thank you Brett for your reply. I was experimenting with https://www.ghielectronics.com/docs/178/wifi-rn171-module which is probably not a good starting point. This example never ran without warning messages. I had not read
http://blogs.msdn.com/b/net_gadgeteer/archive/2011/12/19/why-not-while-true.aspx
The initialisation function can enter into a while(true) loop for listening which may never time out. For this wifly example what would be a better structure?
Thanks,
Kevin.


#4

I’d just use a separate thread - or you could use a “connect” button module to start that process, in a Button Pressed event ?


#5

Thanks Brett. I will try creating a new thread in ProgramStarted() and I will remove the listening thread from the wifly module code. Just an experiment. Cheers.