1 Star 0 Fork 1

Enock / Protothreads

forked from vjiot / Protothreads 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Protothreads

Protothreads are extremely lightweight stackless threads designed for severely memory constrained systems, such as small embedded systems or wireless sensor network nodes. Protothreads provide linear code execution for event-driven systems implemented in C. Protothreads can be used with or without an underlying operating system to provide blocking event-handlers. Protothreads provide sequential flow of control without complex state machines or full multi-threading.

#include "pt.h"
 
struct pt pt;
struct timer timer;
 
PT_THREAD(example(struct pt *pt))
{
  PT_BEGIN(pt);
 
  while(1) {
    if(initiate_io()) {
      timer_start(&timer);
      PT_WAIT_UNTIL(pt,
         io_completed() ||
         timer_expired(&timer));
      read_data();
    }
  }
  PT_END(pt);
}

Example protothreads code.

While protothreads originally were created for memory-constrained embedded systems, it has found many uses as a general purpose library too. Examples include multimedia streaming server software, grid computing research software, and MPEG decoding software for Internet TVs.

[Read more...](./About Protothreads.md)

Main features:

  • Very small RAM overhead - only two bytes per protothread and no extra stacks
  • Highly portable - the protothreads library is 100% pure C and no architecture specific assembly code
  • Can be used with or without an OS
  • Provides blocking wait without full multi-threading or stack-switching
  • Freely available under a BSD-like open source license

Example applications:

  • Memory constrained systems
  • Event-driven protocol stacks
  • Small embedded systems
  • Sensor network nodes
  • Portable C applications

For example usages, see the Examples page.

The protothreads library is released under an open source BSD-style license that freely allows for both non-commercial and commercial usage. The only requirement is that credit is given. Download the full source code here.

Protothreads were invented by Adam Dunkels with support from Oliver Schmidt ol.sc@web.de.

MIT License Copyright (c) 2021 vjiot-open Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

Protothreads 嵌入式 IOT 超轻量级多线程系统, 源自 contiki 的内核, 可在 MCS51, STM8, Cortex-M0 等资源有限的 MCU 上实现多线程编程。 展开 收起
C/C++
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
C/C++
1
https://gitee.com/yuanxiaoyu/protothreads.git
git@gitee.com:yuanxiaoyu/protothreads.git
yuanxiaoyu
protothreads
Protothreads
master

搜索帮助