arkhipenko / TaskScheduler

Cooperative multitasking for Arduino, ESPx, STM32, nRF and other microcontrollers
http://playground.arduino.cc/Code/TaskScheduler
BSD 3-Clause "New" or "Revised" License
1.23k stars 224 forks source link

Add destructor to Task #30

Closed BlackEdder closed 6 years ago

BlackEdder commented 7 years ago

This ensures that a task is deleted from the scheduler when its destructor gets called, i.e. it goes out of scope.

arkhipenko commented 7 years ago

Yes. I should have implemented it to begin with. Never used non-static Tasks - somehow never needed one. But with more powerful MCs with lots of memory - let's do this properly.

Will test and merge.

arkhipenko commented 7 years ago

Added to the "testing" branch. Will merge with "master" once thoroughly tested with all the existing examples and prior code. Also need to create a specific test case/example where tasks are actually deleted.

arkhipenko commented 7 years ago

Fixed in testing branch. Would you please test/confirm?

BlackEdder commented 6 years ago

@arkhipenko I have been trying to get this to compile, but keep getting errors about double definitions. It is like it is trying to include the same header file twice. Have you had any problems getting the _TASK_STD_FUNCTION examples to compile?

Also it might be good to enable std function support on the ESP32 board as well, currently it can only be enabled on ESP8266.

BlackEdder commented 6 years ago

Another good addition would be to define

#define TASK_MILLISECOND   ...

similar to TASK_SECOND etc.

arkhipenko commented 6 years ago

I could only compile STD_FUNCTIONS on ESP8266 board. Any other board - BOOM. The new typedefs are not compiling consistently either: could you have a look at #28?