⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 queue.cpp

📁 在Linux底下用QtDesigner开发的一个进程同步例子。基本思想是设计一个缓冲区(循环队列)
💻 CPP
字号:
#include "queue.h"HQueue::HQueue(int sz):rear(0),front(0),m(sz){//tag(0),//structure function,to create a empty Queue that have the max size of m   Q =new Circle[m];                                            //create Queue space   Q_ASSERT (Q != 0 );      //if(Q==0)       //return;	   //assert:if the alloc storage succeed }void HQueue::EnQueue(Circle& item){//insert function   //assert(!IsFull());      Q_ASSERT(!IsFull());   rear = (rear + 1) % m;                                     //   Q[rear] = item;                                            //   //tag = 1;       }Circle HQueue::DeQueue(){//   //assert(!IsEmpty());        Q_ASSERT(!IsEmpty());      front = (front + 1) % m;                                   //      //tag = 0;                                                   //      return Q[front];        }Circle HQueue::GetFront(){//   Q_ASSERT(!IsEmpty());                               //   return Q[(front + 1) % m] ;      }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -