int main() { Queue q; int nData = 0; int nLength = 0; BOOL bEmpty = FALSE; InitQueue(&q); EnQueue(&q, 12); EnQueue(&q, 3); EnQueue(&q, 8); EnQueue(&q, 34); EnQueue(&q, 6); EnQueue(&q, 9); EnQueue(&q, 56); EnQueue(&q, 78); EnQueue(&q, 4); EnQueue(&q, 90); printf("入队后的队列:"); TraverseQueue(&q, OutputQueue); nLength = GetQueueLength(&q); printf("队列长度:%d\n", nLength); bEmpty = IsQueueEmpty(&q); printf("队列为%s\n", bEmpty ? "空" : "非空"); DeQueue(&q, &nData); printf("出队数据:%d\n", nData); printf("出队后的队列:"); TraverseQueue(&q, OutputQueue); DeQueue(&q, &nData); printf("出队数据:%d\n", nData); printf("出队后的队列:"); TraverseQueue(&q, OutputQueue); DestroyQueue(&q); return 0; }
bool QueuedCPUTracker::IsIdle() { return GetQueueLength() == 0; }