⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 local_heap.c

📁 xenomai 很好的linux实时补丁
💻 C
字号:
#include <native/heap.h>#define HEAP_SIZE (256*1024)#define HEAP_MODE 0		/* Local heap. */RT_HEAP heap_desc;int init_module (void){    void *block;    int err;    /* Create a 256Kb heap usable for dynamic memory allocation of       variable-size blocks in kernel space. */    err = rt_heap_create(&heap_desc,"MyHeapName",HEAP_SIZE,HEAP_MODE);    if (err)	fail();    /* Request a 16-bytes block, asking for a non-blocking call since       only Xenomai tasks may block. */    err = rt_heap_alloc(&heap_desc,16,TM_NONBLOCK,&block);    if (err)	goto no_memory;    /* Free the block: */    rt_heap_free(&heap_desc,block);       /* ... */}void cleanup_module (void){    rt_heap_delete(&heap_desc);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -