【发布时间】:2012-07-29 14:38:18
【问题描述】:
在my previous 发帖之后,我想更进一步:
我想分配一个共享内存区域,并为分配/共享的区域设置初始值 数据:
static struct PipeShm myPipeSt = {.init = 0 , .flag = FALSE , .mutex = NULL , .ptr1 = NULL , .ptr2 = NULL ,
.status1 = -10 , .status2 = -10 , .semaphoreFlag = FALSE };
int shmid = shmget(IPC_PRIVATE, sizeof(int), 0600);
static struct PipeShm * myPipe = shmat(shmid, NULL, 0); // &myPipeSt;
myPipe = & myPipeSt; // that doesn't compile
建议?
非常感谢!
【问题讨论】:
标签: c linux struct shared-memory