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


C++ InterthreadQueue::readNoBlock方法代码示例

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


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

示例1: processRaches

// Return true if the CCCH frame was used.
bool CCCHLogicalChannel::processRaches()
{
	while (RachInfo *rach = gRachq.readNoBlock())
	{
		Time now = gBTS.time();
		int age = now - rach->mWhen;	// The result is number of frames and could be negative.
		if (age>sMaxAge) {
			LOG(WARNING) << "ignoring RACH burst with age " << age;
			if (rach->mChan) {
				LOG(INFO) << "BTS congestion: unable to process RACH for pre-allocated channel within expiration time";
				rach->mChan->l2sendp(L3_HARDRELEASE_REQUEST);	// (pat) added 9-6-2013
			}
			delete rach;
			continue;	// Did not use the CCCH frame yet.
		}


		ChannelType chtype = decodeChannelNeeded(rach->mRA);
		LOG(DEBUG) <<LOGVAR(*rach) <<LOGVAR(chtype) <<LOGVAR(mCcchGroup);

		if (chtype == PSingleBlock1PhaseType || chtype == PSingleBlock2PhaseType) {
			assert(rach->mChan == NULL);
			if (0 == gConfig.getNum("GPRS.Enable")) {
				// GPRS service request when the beacon advertises no beacon support.
				// This was a spurious RACH message or a stupid handset.  Ignore it.
				assert(rach->mChan == NULL);
				delete rach;
				continue;
			}
			// Regardless of the type of GPRS request, we will send a single-block uplink,
			// which the MS will (most likely) use to send us a PacketResourceRequest.
			// First request a single-block reservation from GPRS.  If GPRS resources are busy,
			// this will return NULL and we will send reject the RACH.
			L3ImmediateAssignment *iap = GPRS::makeSingleBlockImmediateAssign(rach, mCcchNextWriteTime.FN() + 4);
			if (iap) {
				L2LogicalChannelBase::l2sendm(*iap,L3_UNIT_DATA);
				delete iap;
				delete rach;
			} else {
			}
			return true;	// We processed this rach and used the CCCH, one way or another.
		}

//		L2LogicalChannel *LCH;
//		if (chtype == TCHFType) {
//			// FIXME: This blocks at L2LAPDm::sendIdle!
//			LCH = gBTS.getTCH();
//		} else if (chtype == SDCCHType) {
//			// We may reserve some SDCCH for CC and SMS.
//			if (requestingLUR(rach->mRA)) {
//				int SDCCHAvailable = gBTS.SDCCHAvailable();
//				int SDCCHReserve = gConfig.getNum("GSM.Channels.SDCCHReserve");
//				if (requestingLUR(rach->mRA) && SDCCHAvailable <= SDCCHReserve) {
//					// (pat 2-2014) Changed this message and downgraded from CRIT.
//					LOG(CRIT) << "LUR [Location Update Request] congestion, insufficient "<<LOGVAR(SDCCHAvailable) << " <= " <<LOGVAR(SDCCHReserve);
//					goto failure;
//				}
//			}
//
//			LCH = gBTS.getSDCCH();
//		} else {
//			LOG(NOTICE) << "RACH burst for unsupported service RA=" << rach->mRA;
//			LCH = gBTS.getSDCCH();	// Try anyway.
//		}
//
//
//		// Nothing available?
//		if (!LCH) {
//			failure:
#if 0
//			return false;
#endif
//		}

		if (! rach->mChan) {
			delete rach;
			continue;
		}

		// Success.  Send an ImmediateAssignment.
		int initialTA = rach->initialTA();
		assert(initialTA >= 0 && initialTA <= 62);	// enforced by AccessGrantResponder.
		//LCH->l1InitPhy(rach->RSSI(),initialTA,gBTS.clock().systime(rach->mWhen.FN()));
		gReports.incr("OpenBTS.GSM.RR.RACH.TA.Accepted",(int)(initialTA));
		L2LogicalChannel *LCH = rach->mChan;

		// TODO: Update T3101.

		L3ImmediateAssignment assign(
			L3RequestReference(rach->mRA,rach->mWhen),
			LCH->channelDescription(),
			L3TimingAdvance(initialTA)
		);
		//assign.setStartFrame(rach->mReadyTime.FN() + 104);

		if (0) {	// This was for debugging.  Adding this delay made the layer1 connection reliable.
			// Delay the channel assignment until the SACCH is known to be transmitting...
			Time sacchStart = LCH->getSACCH()->getNextWriteTime();
			now = gBTS.time();	// Must update this because getTCH blocked.
//.........这里部分代码省略.........
开发者ID:ankitag9,项目名称:openbts,代码行数:101,代码来源:GSMCCCH.cpp


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