当前位置: 首页>>代码示例>>C++>>正文


C++ TQueue::IsFull方法代码示例

本文整理汇总了C++中TQueue::IsFull方法的典型用法代码示例。如果您正苦于以下问题:C++ TQueue::IsFull方法的具体用法?C++ TQueue::IsFull怎么用?C++ TQueue::IsFull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TQueue的用法示例。


在下文中一共展示了TQueue::IsFull方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ReceiveDataCallback

void DZeroCopyLoopbackDevice::ReceiveDataCallback()
	{
	// Copy buffer from send queue (it's like our receive hardware) to receive queue
	DCommsBuf* srcBuf = iSendQueue.HeadBuffer();
	if(!iReceiveQueue.IsFull() && !iSendQueue.IsEmpty())
		{
		// Alloc a new buffer in to which we will copy the received (sent) buffer (mimicking DMA in the non zerocopy case)
		DCommsBuf newBuf;
		TInt result = iLdd->Pond().Alloc(newBuf);
		if(result == KErrNone)
			{
			// Copy our buffer and set the new buffer's properties
			TInt srcPayloadLength = srcBuf->Length();
			newBuf.SetOffset(0);
			newBuf.SetLength(srcPayloadLength);

			// Do the copy
			TUint8* srcPayloadPtr = srcBuf->Ptr();
			TUint8* destPayloadPtr = newBuf.Ptr();
			memcpy(destPayloadPtr, srcPayloadPtr, srcPayloadLength);

			// Put the new buffer in the receive queue
			DCommsBuf* destBuf = iReceiveQueue.TailBuffer();
			*destBuf = newBuf;
			iReceiveQueue.Push();

			// Drop the incoming buffer
			srcBuf->Free();

			// Step the queue
			iSendQueue.Pop();
			}

		// We can now complete any outstanding request for received data - if indeed we managed to alloc a receive buffer
		if(iPendingRead && !iReceiveQueue.IsEmpty())
			{
			iPendingRead = FALSE;
			
			// Tell LDD we're done
			iLdd->ReceiveDataComplete(KErrNone);
			}
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:43,代码来源:pdd.cpp

示例2: sim

void sim()
{
	int j = 0;
	int tickskip = 0, proctime = 0, taskskip = 0;
	int tick;
	int critT, critP;
	TQueue queue;

	printf("??????? ??????????? ???????? ?????\n");
	critT = input(DIAP);
	printf("??????? ??????????? ???????? ??????????\n");
	critP = input(DIAP);

	printf("??????? ?????????? ??????\n");
	tick = input(9000);
	if (tick < 20)
	{
		for (int i = 0; i < tick; i++)
		{
			if (TaskRand(critT))
			{
				if (!queue.IsFull())
				{
					queue.Put(1);
					printf("????????? ??????\n");
				}
				else
				{
					taskskip++;
					printf("?????? ?????????\n");
				}
			}
			if (proctime != 0)
			{
				printf("????????? ???????????? ??????\n");
				if (ProcRand(critP))
				{
					proctime = 0;
					printf("?????? ??????????\n");
				}
				else
				{
					proctime++;
					printf("?????? ??????????????\n");
				}
			}
			else if (!queue.IsEmpty())
			{
				printf("????????? ?????? ??????\n");
				queue.Push();
				if (ProcRand(critP))
				{
					printf("?????? ??????????\n");
				}
				else
				{
					proctime++;
					printf("?????? ??????????????\n");
				}
			}
			else
			{
				tickskip++;
				printf("????????? ???????????\n");
			}
		}
		while (!queue.IsEmpty())
		{
			queue.Push();
			j++;
		}
	}
	else
	{
		for (int i = 0; i < tick; i++)
		{
			if (TaskRand(critT))
			{
				if (!queue.IsFull())
				{
					queue.Put(1);
				}
				else
				{
					taskskip++;
				}
			}
			if (proctime != 0)
			{
				if (ProcRand(critP))
				{
					proctime = 0;
				}
				else
				{
					proctime++;
				}
			}
			else if (!queue.IsEmpty())
			{
//.........这里部分代码省略.........
开发者ID:UniquerName,项目名称:Procc,代码行数:101,代码来源:main.cpp


注:本文中的TQueue::IsFull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。