How to “multithread” C code

后端 未结 12 1753
暗喜
暗喜 2020-12-02 09:30

I have a number crunching application written in C. It is kind of a main loop that for each value calls, for increasing values of \"i\", a function that performs some calcul

12条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-02 09:56

    Depending on the OS, you could use posix threads. You could instead implement stack-less multithreading using state machines. There is a really good book entitled "embedded multitasking" by Keith E. Curtis. It's just a neatly crafted set of switch case statements. Works great, I've used it on everything from apple macs, rabbit semiconductor, AVR, PC.

    Vali

提交回复
热议问题