一、消息队列
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <strings.h>
#include <stdio.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <sys/shm.h>
#include <semaphore.h>
#include <pthread.h>
struct msgbuf{
long mtype;
char mtext[50];
};
void *routine1(void *arg)
{
struct msgbuf buf;
int msgid = (int)arg;
int ret;
while(1)
{
bzero(&buf,sizeof(buf));
ret = msgrcv(msgid,&buf,sizeof(buf),30