小编Nod*_*ens的帖子

使用 IPC 队列发送消息时,标识符已删除 (EIDRM) 错误

我正在使用 IPC 队列进行进程同步。

从 IPC 队列发送接收消息时,我总是收到 EIDRM 错误,但我可以看到队列与 ipcs 一起存在。

我已经搜索了 2 个小时,但我看不到错误。

下面的代码是一个精简的版本,它给了我同样的错误。

#define CLAVE 53543961
#define TAM_BUFFER 1024
#define PERMISOS 0777
#define DEBUG

int Cola_Mensages;
int msgqid;


typedef struct  {
    long mtype;
    char mtext[TAM_BUFFER];
}msgbuf;


int main (int argc, char *argv[]){
    msgbuf msg_ipc;
    int num_cli,i, i_aux;

    if(argc == 2){
    num_cli = atoi(argv[1]);
    }else{ 
    num_cli = 1;
    }


    //Creating the queue
    if(msgqid = msgget(CLAVE,PERMISOS|IPC_CREAT)<0){
        fprintf(stderr,"Problema al crear la cola de mensages IPC\n");
        exit(0);
    }

    if(msgqid < 0){
        fprintf(stderr,"Problema al …
Run Code Online (Sandbox Code Playgroud)

c ipc message-queue

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

c ×1

ipc ×1

message-queue ×1