1 Star 1 Fork 0

沈旭彬/C++代码

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Server.cc 579 Bytes
一键复制 编辑 原始数据 按行查看 历史
#include "shared_memory.hpp"
#include "namedPipe.hpp"
int main()
{
key_t key = get_key(PATHNAME, PROJ_ID);
int shmid = create_shared_memory(key, DEFAULT_SIZE);
cout << shmid << endl;
//挂接
char* addr = (char*)shm_attch(shmid);
Fifo fifo(NAME);
Sync syn;
syn.open_read();
while (true)
{
int n = syn.wait();
cout << "共享内存中的数据是:" << addr << endl;
if(n <= 0)
break;
}
//去挂接
shm_detach(addr);
//删除共享内存
shm_del(shmid);
return 0;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/shenxubin/d-code.git
git@gitee.com:shenxubin/d-code.git
shenxubin
d-code
C++代码
master

搜索帮助