Main Site Documentation

Threads or Main Loop


#1

Looking for the experience of the developers around. I have started to write the next version of my firmware (that’s the one I hope to put the G-Code parser in @Gus). I have a number of “tasks” that need to run on the device to check things like the power button state, the network, the driver status the LEDs etc.

Should I use threads or should I write everything as calls from the main loop. My main concern is that TinyCLR doesn’t (correct me if i’m wrong) have thread.priority. So if a task gets stuff doing some complex task (like https page serving) then I don’t want the system waiting a long time to do important stuff like checking the flag pin on the stepper drivers.

I guess I just answered my question. Any thoughts?


#2

There is priority but what it does of basically give the priority thread gets more time than lower priority.

I personally only use thread when there is a good reason to do so. Same goes for resource actually. I only use when there is a good reason.