项目
在 GitHub 查看
jnk0le/Ring-Buffer
关于
简单的 C++11 环形缓冲区实现,可在编译时分配并求值。
其他项目实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- -1
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文Ring Buffer
- pure C++11, no OS dependency
- lock and wait free bounded SPSC operation
- no exceptions, RTTI, virtual functions and dynamic memory allocation
- designed for compile time (static) allocation and type evaluation
- no wasted slots (in powers of 2 granularity)
- underrun and overrun checks in insert/remove functions
- highly efficient on most microcontroller architectures (nearly equal performance as in 'wasted-slot' implemetation)
notes
- index_t of size less than architecture reg size (size_t) might not be most efficient (known gcc bug)
- Only lamda expressions or functor callbacks can be inlined into
buffWrite/buffReadfunctions - 8 bit architectures are not supported in master branch at the moment. Broken code is likely to be generated
- relaxed atomic stores on RISC-V gcc port may be inefficient
- the DEC Alpha ultra-weak memory model is not supported
example
jnk0le::Ringbuffer<const char*, 256> message;
int main()
{
//...
while(1)
{
const char* tmp = nullptr;
while(!message.remove(tmp));
printf("%s fired\n", tmp);
//...
}
}
extern "C" void SysTick_Handler(void)
{
message.insert("SysTick_Handler");
}
探索相关项目
加载中…