23,128
社区成员
发帖
与我相关
我的任务
分享
semget(key, 1, 0)
union semun {
int val; /* Value for SETVAL */
struct semid_ds *buf; /* Buffer for IPC_STAT, IPC_SET */
unsigned short *array; /* Array for GETALL, SETALL */
struct seminfo *__buf; /* Buffer for IPC_INFO
(Linux-specific) */
};
if(-1 == (key = ftok(ACE_MANAGE_USER_FILE_NAME, 0xF)))
{
ace_printf("create key fail\r\n");
return -4;
}
if((mutex_id = semget(key, 1, IPC_CREAT|00666)) == -1)
{
ace_printf("sem get fail\r\n");
return -5;
}
if(semctl(mutex_id, 0, SETVAL, 1) == -1)
{
ace_printf("sem control init fail\r\n");
return -6;
}