contiki-os / contiki

The official git repository for Contiki, the open source OS for the Internet of Things
http://www.contiki-os.org/
Other
3.72k stars 2.58k forks source link

Migrate from protothreads 1.4 to protothreads 2.0 #2726

Open jklarenbeek opened 2 months ago

jklarenbeek commented 2 months ago

Hi,

I've updated the protothreads 1.4 library that is currently used in contiki-os to protothreads library 2.0.

I have looked into the code of contiki-os and see no direct problems using this for contiki-os but leverages a view possible advantages:

1) more control flow constructs like try catch finally, without the overhead. 2) better handling of yielding functions. 3) error handling by state with additional overhead.

I haven't been able to spot any problems for contiki-os using protothreads v2 as long it uses the lc-switch.h duff-device construct and NOT the lc-addrlabels.h construct. This is btw, prone to errors on the long run anyway.

You can find the protothreads v2 library as a module in the protoduino framework at: https://github.com/jklarenbeek/protoduino

I was wondering what you would think about this change.

Regards,

Joham