使用方式一:
------------------------------------------------
读进程: 读方式打开;
       while(1){
          读PIPE
          if(得到数据){}
          else { sleep x}
       }
       关闭
这种方式,在得到数据为0时,应该sleep。
因为测试发现其行为是,第一次读会block,之后即使没数据也会立即返回?

使用方式二:
----------------------------------------------
读进程: while(1)
       {
          只读打开
          while(读数据 > 0)
         {处理}
          关闭
        }

写进程:写打开;写数据;关闭;

因为写数据会阻塞到读数据的开始,写完之后交给读端。

As example:
void OSD_TEST(void)
{
    int result;
    int fifo_fd;
    int len;
    char line[LINE_BUF];

    upgrade_osd_init(vinfo.xres, vinfo.yres);

    while(1)
    {
        //open fifo
        fifo_fd = open(FIFO_NAME, O_RDONLY, 0);
        if(fifo_fd < 0){
            printf("Err: open fifo failed\n"); //should never happen
            return;
        }
        //read fifo
        while((len = read(fifo_fd, line, LINE_BUF)) > 0)
        {
            data_process(len, line);
        }
         
        //close fifo
        close(fifo_fd);
    }

 
}