您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ IsLocked函数代码示例

51自学网 2021-06-01 21:41:46
  C++
这篇教程C++ IsLocked函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中IsLocked函数的典型用法代码示例。如果您正苦于以下问题:C++ IsLocked函数的具体用法?C++ IsLocked怎么用?C++ IsLocked使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

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

示例1: GetState

CTrafficLights::eTrafficLightState CTrafficLights::GetState(){	if(IsLocked())		return m_eStateSet;	if(m_eStateSet >= TRAFFIC_LIGHT_STATE_FLASHING_FLASHING)		return m_eStateSet;	if(m_uiTotalDuration == 0)		return TRAFFIC_LIGHT_STATE_DISABLED_DISABLED;	// Get the state based on the time elapsed in that cycle	unsigned int uiTimePassed = GetTimeThisCylce();	if(uiTimePassed < m_uiGreenDuration)		return TRAFFIC_LIGHT_STATE_GREEN_RED;	else if(uiTimePassed < m_uiGreenDuration + m_uiYellowDuration)		return TRAFFIC_LIGHT_STATE_YELLOW_RED;		else if(uiTimePassed < m_uiGreenDuration + m_uiYellowDuration + m_uiRedDuration)		return TRAFFIC_LIGHT_STATE_RED_RED_1;		else if(uiTimePassed < m_uiGreenDuration + 2 * m_uiYellowDuration + m_uiRedDuration)		return TRAFFIC_LIGHT_STATE_RED_TO_GREEN;		else if(uiTimePassed < 2 * m_uiGreenDuration + 2 * m_uiYellowDuration + m_uiRedDuration)		return TRAFFIC_LIGHT_STATE_RED_GREEN;		else if(uiTimePassed < 2 * m_uiGreenDuration + 3 * m_uiYellowDuration + m_uiRedDuration)		return TRAFFIC_LIGHT_STATE_RED_YELLOW;		else if(uiTimePassed < 2 * m_uiGreenDuration + 3 * m_uiYellowDuration + 2 * m_uiRedDuration)		return TRAFFIC_LIGHT_STATE_RED_RED_2;	else		return TRAFFIC_LIGHT_STATE_TO_GREEN_RED;}
开发者ID:andrefsantos,项目名称:IVMultiplayer-1,代码行数:38,


示例2: ToggleOpenTargets

void CFrobLock::ToggleOpenTargets(){	if (IsLocked())	{		// We're still locked, play the locked sound and exit		FrobLockStartSound("snd_locked");	}	else	{		// Actually open any targetted frobmovers		for ( int i = 0 ; i < targets.Num() ; i++ )		{			idEntity* target = targets[i].GetEntity();			if ( (target == NULL) || !target->IsType(CBinaryFrobMover::Type))			{				continue;			}			static_cast<CBinaryFrobMover*>(target)->ToggleOpen();		}	}}
开发者ID:nbohr1more,项目名称:TheDarkMod_SVN_Unofficial-1,代码行数:23,


示例3: GetKey

bool CAccountHD::GetKey(const CKeyID& keyID, CKey& key) const{    if (IsLocked())        return false;    int64_t nKeyIndex = -1;    CExtKey privKey;    if (externalKeyStore.GetKey(keyID, nKeyIndex)) {        primaryChainKeyPriv.Derive(privKey, nKeyIndex);        if (privKey.Neuter().pubkey.GetID() != keyID)            assert(0);        key = privKey.key;        return true;    }    if (internalKeyStore.GetKey(keyID, nKeyIndex)) {        changeChainKeyPriv.Derive(privKey, nKeyIndex);        if (privKey.Neuter().pubkey.GetID() != keyID)            assert(0);        key = privKey.key;        return true;    }    return false;}
开发者ID:Gulden,项目名称:gulden-official,代码行数:23,


示例4: SetCaretPos

int32_t CFDE_TxtEdtEngine::SetCaretPos(int32_t nIndex, FX_BOOL bBefore) {  if (IsLocked()) {    return 0;  }  ASSERT(nIndex >= 0 && nIndex <= GetTextBufLength());  if (m_PagePtrArray.GetSize() <= m_nCaretPage) {    return 0;  }  m_bBefore = bBefore;  m_nCaret = nIndex;  MovePage2Char(m_nCaret);  GetCaretRect(m_rtCaret, m_nCaretPage, m_nCaret, m_bBefore);  if (!m_bBefore) {    m_nCaret++;    m_bBefore = TRUE;  }  m_fCaretPosReserve = (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical)                           ? m_rtCaret.top                           : m_rtCaret.left;  m_Param.pEventSink->On_CaretChanged(this, m_nCaretPage, 0);  m_nAnchorPos = -1;  return m_nCaret;}
开发者ID:hfiguiere,项目名称:pdfium,代码行数:23,


示例5: MOZ_ASSERT_UNREACHABLE

voidDecodedSurfaceProvider::SetLocked(bool aLocked){  // See DrawableRef() for commentary on these assertions.  if (Availability().IsPlaceholder()) {    MOZ_ASSERT_UNREACHABLE("Calling SetLocked() on a placeholder");    return;  }  if (!mSurface) {    MOZ_ASSERT_UNREACHABLE("Calling SetLocked() when we have no surface");    return;  }  if (aLocked == IsLocked()) {    return;  // Nothing to do.  }  // If we're locked, hold a DrawableFrameRef to |mSurface|, which will keep any  // volatile buffer it owns in memory.  mLockRef = aLocked ? mSurface->DrawableRef()                     : DrawableFrameRef();}
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:23,


示例6: SelectActors

void FLevelViewModel::SelectActors( bool bSelect, bool bNotify, bool bSelectEvenIfHidden, const TSharedPtr< IFilter< const TWeakObjectPtr< AActor >& > >& Filter ){	if( !Level.IsValid() || IsLocked() )	{		return;	}	Editor->GetSelectedActors()->BeginBatchSelectOperation();	bool bChangesOccurred = false;	// Iterate over all actors, looking for actors in this level.	ULevel* RawLevel = Level.Get();	for ( int32 ActorIndex = 2 ; ActorIndex < RawLevel->Actors.Num() ; ++ActorIndex )	{		AActor* Actor = RawLevel->Actors[ ActorIndex ];		if ( Actor )		{			if( Filter.IsValid() && !Filter->PassesFilter( Actor ) )			{				continue;			}			bool bNotifyForActor = false;			Editor->GetSelectedActors()->Modify();			Editor->SelectActor( Actor, bSelect, bNotifyForActor, bSelectEvenIfHidden );			bChangesOccurred = true;		}	}	Editor->GetSelectedActors()->EndBatchSelectOperation();	if( bNotify )	{		Editor->NoteSelectionChange();	}}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:36,


示例7: NSLOCTEXT

void FLevelViewModel::Save(){	if ( !IsLevel() )	{		return;	}	if ( !IsVisible() )	{		FMessageDialog::Open( EAppMsgType::Ok, NSLOCTEXT("UnrealEd", "UnableToSaveInvisibleLevels", "Save aborted.  Levels must be made visible before they can be saved.") );		return;	}	else if ( IsLocked() )	{		FMessageDialog::Open( EAppMsgType::Ok, NSLOCTEXT("UnrealEd", "UnableToSaveLockedLevels", "Save aborted.  Level must be unlocked before it can be saved.") );		return;	}	// Prompt the user to check out the level from source control before saving if it's currently under source control	if ( FEditorFileUtils::PromptToCheckoutLevels( false, Level.Get() ) )	{		FEditorFileUtils::SaveLevel( Level.Get() );	}}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:24,


示例8:

//------------------------------------------------------------------------------voidBLocker::Unlock(void){	// If the thread currently holds the lockdecrement	if (IsLocked()) {			// Decrement the number of outstanding locks this thread holds		// on this BLocker.		fRecursiveCount--;				// If the recursive count is now at 0, that means the BLocker has		// been released by the thread.		if (fRecursiveCount == 0) {					// The BLocker is no longer owned by any thread.			fLockOwner = B_ERROR;		    		// Decrement the benaphore count and store the undecremented    		// value in oldBenaphoreCount.			//int32 oldBenaphoreCount = atomic_add(&fBenaphoreCount, -1);			// TODO: use atomic_dec(&fBenaphoreCount) instead			int32 oldBenaphoreCount = atomic_add(&fBenaphoreCount, -1);						// If the oldBenaphoreCount is greater than 1, then there is			// at lease one thread waiting for the lock in the case of a			// benaphore.   		    if (oldBenaphoreCount > 1) { 				 				// Since there are threads waiting for the lock, it must 				// be released.  Note, the old benaphore count will always be 				// greater than 1 for a semaphore so the release is always done.    			release_sem(fSemaphoreID);	    	}	    }    }		}
开发者ID:BackupTheBerlios,项目名称:nemo,代码行数:37,


示例9:

BOOL S3PDBSocketPool::ShowAllClientInfo(){	if (IsLocked())		return FALSE;	Lock();	BOOL b = FALSE;	GatewayIDMap::iterator i = m_clientIDs.begin();	int n = 0;	while (i != m_clientIDs.end())	{		KGatewayDataProcess* p = i->second;		if (p)		{			in_addr add;			add.s_addr = p->m_Address;			gTrace("Client %d: %s(%s)", n, p->m_ServerName.c_str(), inet_ntoa(in_addr(add))); 		}		i++;		n++;	}	b = TRUE;	Unlock();	return b;}
开发者ID:XeanoRRR,项目名称:mmo-resourse,代码行数:24,


示例10: GetLevelObject

void FLevelModel::SetLocked(bool bLocked){	if (LevelCollectionModel.IsReadOnly())	{		return;	}			ULevel* Level = GetLevelObject();	if (Level == NULL)	{		return;	}	// Do nothing if attempting to set the level to the same locked state	if (bLocked == IsLocked())	{		return;	}	// If locking the level, deselect all of its actors and BSP surfaces	if (bLocked)	{		DeselectAllActors();		DeselectAllSurfaces();		// Tell the editor selection status was changed.		Editor->NoteSelectionChange();		// If locking the current level, reset the p-level as the current level		//@todo: fix this!	}	// Change the level's locked status	FLevelUtils::ToggleLevelLock(Level);}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:36,


示例11: CanUnload

 /// /brief ///   Flag that determines whether the resource can currently unload itself. Used by the resource manager. inline BOOL CanUnload() const         {return IsResourceFlagSet(VRESOURCEFLAG_ALLOWUNLOAD) && !IsLocked();}
开发者ID:guozanhua,项目名称:projectanarchy,代码行数:3,


示例12: wxRemoveFile

BlockFile::~BlockFile(){   if (!IsLocked() && mFileName.HasName())      wxRemoveFile(mFileName.GetFullPath());}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:5,


示例13: GetOutputCurrentType

HRESULT CHWMFT::GetOutputCurrentType(    DWORD           dwOutputStreamID,    IMFMediaType**  ppType){    /*****************************************    ** See http://msdn.microsoft.com/en-us/library/ms696985(v=VS.85).aspx    *****************************************/    HRESULT         hr      = S_OK;    IMFMediaType*   pMT     = NULL;    do    {        /************************************        ** Since this MFT is a decoder, it        ** must not allow this function to be        ** called until it is unlocked. If        ** your MFT is an encoder, this function        ** CAN be called before the MFT is        ** unlocked        ************************************/        if(IsLocked() != FALSE)        {            hr = MF_E_TRANSFORM_ASYNC_LOCKED;            break;        }        if(ppType == NULL)        {            hr = E_POINTER;            break;        }        /*****************************************        ** Todo: If your MFT supports more than one        ** stream, make sure you modify        ** MFT_MAX_STREAMS and adjust this function        ** accordingly        *****************************************/        if(dwOutputStreamID >= MFT_MAX_STREAMS)        {            hr = MF_E_INVALIDSTREAMNUMBER;            break;        }        {            CAutoLock lock(&m_csLock);            if(m_pOutputMT == NULL)            {                hr = MF_E_TRANSFORM_TYPE_NOT_SET;                break;            }            /*******************************************            ** Return a copy of the media type, not the             ** internal one. Returning the internal one             ** will allow an external component to modify            ** the internal media type            *******************************************/            hr = MFCreateMediaType(&pMT);            if(FAILED(hr))            {                break;            }            hr = DuplicateAttributes(pMT, m_pOutputMT);            if(FAILED(hr))            {                break;            }        }        (*ppType) = pMT;        (*ppType)->AddRef();    }while(false);    SAFERELEASE(pMT);    return hr;}
开发者ID:DMFZ,项目名称:Windows-classic-samples,代码行数:82,


示例14: MSG_PANEL_ITEM

void MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ){    int      nbpad;    wxString msg;    aList.push_back( MSG_PANEL_ITEM( m_Reference->GetShownText(), m_Value->GetShownText(), DARKCYAN ) );    // Display last date the component was edited (useful in Module Editor).    wxDateTime date( m_LastEditTime );    if( m_LastEditTime && date.IsValid() )    // Date format: see http://www.cplusplus.com/reference/ctime/strftime        msg = date.Format( wxT( "%b %d, %Y" ) ); // Abbreviated_month_name Day, Year    else        msg = _( "Unknown" );    aList.push_back( MSG_PANEL_ITEM( _( "Last Change" ), msg, BROWN ) );    // display schematic path    aList.push_back( MSG_PANEL_ITEM( _( "Netlist Path" ), m_Path, BROWN ) );    // display the board side placement    aList.push_back( MSG_PANEL_ITEM( _( "Board Side" ),                     IsFlipped()? _( "Back (Flipped)" ) : _( "Front" ), RED ) );    EDA_ITEM* PtStruct = m_Pads;    nbpad = 0;    while( PtStruct )    {        nbpad++;        PtStruct = PtStruct->Next();    }    msg.Printf( wxT( "%d" ), nbpad );    aList.push_back( MSG_PANEL_ITEM( _( "Pads" ), msg, BLUE ) );    msg = wxT( ".." );    if( IsLocked() )        msg[0] = 'L';    if( m_ModuleStatus & MODULE_is_PLACED )        msg[1] = 'P';    aList.push_back( MSG_PANEL_ITEM( _( "Status" ), msg, MAGENTA ) );    msg.Printf( wxT( "%.1f" ), GetOrientationDegrees() );    aList.push_back( MSG_PANEL_ITEM( _( "Rotation" ), msg, BROWN ) );    // Controls on right side of the dialog    switch( m_Attributs & 255 )    {    case 0:        msg = _( "Normal" );        break;    case MOD_CMS:        msg = _( "Insert" );        break;    case MOD_VIRTUAL:        msg = _( "Virtual" );        break;    default:        msg = wxT( "???" );        break;    }    aList.push_back( MSG_PANEL_ITEM( _( "Attributes" ), msg, BROWN ) );    aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), FROM_UTF8( m_fpid.Format().c_str() ), BLUE ) );    if( m_3D_Drawings.empty() )        msg = _( "No 3D shape" );    else        msg = m_3D_Drawings.front().m_Filename;    // Search the first active 3D shape in list    aList.push_back( MSG_PANEL_ITEM( _( "3D-Shape" ), msg, RED ) );    wxString doc, keyword;    doc.Printf( _( "Doc: %s" ), GetChars( m_Doc ) );    keyword.Printf( _( "Key Words: %s" ), GetChars( m_KeyWord ) );    aList.push_back( MSG_PANEL_ITEM( doc, keyword, BLACK ) );}
开发者ID:nikgul,项目名称:kicad-source-mirror,代码行数:87,


示例15: DebugAssertTrue

void UScheduler::Timer::SetTimeout(U32 timeout){	DebugAssertTrue(IsLocked());	_timeoutTime = System::GetTickCount() + timeout;	AddOperationWithTimeout(_node);}
开发者ID:DVDPT,项目名称:Micro-Operating-System,代码行数:6,


示例16: TraceString

HRESULT CHWMFT::ProcessOutput(    DWORD                   dwFlags,    DWORD                   dwOutputBufferCount,    MFT_OUTPUT_DATA_BUFFER* pOutputSamples,    DWORD*                  pdwStatus){    /*****************************************    ** See http://msdn.microsoft.com/en-us/library/ms704014(v=VS.85).aspx    *****************************************/    HRESULT     hr      = S_OK;    IMFSample*  pSample = NULL;    TraceString(CHMFTTracing::TRACE_INFORMATION, L"%S(): Enter",  __FUNCTION__);    do    {        if(IsLocked() != FALSE)        {            hr = MF_E_TRANSFORM_ASYNC_LOCKED;            break;        }        {            CAutoLock lock(&m_csLock);            TraceString(CHMFTTracing::TRACE_INFORMATION, L"%S(): HaveOutputCount: %u",  __FUNCTION__, m_dwHaveOutputCount);            if(m_dwHaveOutputCount == 0)            {                // This call does not correspond to a have output call                hr = E_UNEXPECTED;                break;            }            else            {                m_dwHaveOutputCount--;            }        }        /*****************************************        ** Todo: If your MFT supports more than one        ** stream, make sure you modify        ** MFT_MAX_STREAMS and adjust this function        ** accordingly        *****************************************/        if(dwOutputBufferCount < MFT_MAX_STREAMS)        {            hr = E_INVALIDARG;            break;        }        if(IsMFTReady() == FALSE)        {            hr = MF_E_TRANSFORM_TYPE_NOT_SET;            break;        }        /***************************************        ** Since this in an internal function        ** we know m_pOutputSampleQueue can never be        ** NULL due to InitializeTransform()        ***************************************/        hr = m_pOutputSampleQueue->GetNextSample(&pSample);        if(FAILED(hr))        {            break;        }        if(pSample == NULL)        {            hr = MF_E_TRANSFORM_NEED_MORE_INPUT;            break;        }        /*******************************        ** Todo: This MFT only has one        ** input stream, so the output        ** samples array and stream ID        ** will only use the first        ** member        *******************************/        pOutputSamples[0].dwStreamID    = 0;                if((pOutputSamples[0].pSample) == NULL)        {            // The MFT is providing it's own samples            (pOutputSamples[0].pSample)   = pSample;            (pOutputSamples[0].pSample)->AddRef();        }        else        {            // The pipeline has allocated the samples            IMFMediaBuffer* pBuffer = NULL;            do            {                hr = pSample->ConvertToContiguousBuffer(&pBuffer);                if(FAILED(hr))//.........这里部分代码省略.........
开发者ID:DMFZ,项目名称:Windows-classic-samples,代码行数:101,


示例17: ubKeepLock

BOOL CGatewayEpos2ToMaxonSerialV1::Process_SegmentWrite(CCommand_DCS* pCommand, CProtocolStackManagerBase* pProtocolStackManager, HANDLE hPS_Handle, HANDLE hTransactionHandle){    const BYTE MAX_SEGMENT_LENGTH = 63;    //*Constants DCS*    const int PARAMETER_INDEX_NODE_ID = 0;    const int PARAMETER_INDEX_CONTROL_BYTE = 1;    const int PARAMETER_INDEX_DATA = 2;    const int RETURN_PARAMETER_INDEX_ERROR_CODE = 0;    const int RETURN_PARAMETER_INDEX_CONTROL_BYTE = 1;    //*Constants PS*    const BYTE OP_CODE = 0x15;    const BYTE DATA_LENGTH = 1;    const BYTE RETURN_DATA_LENGTH = 6;    //*Variables DCS*    //Parameter    BYTE uNodeId = 0;    UEpos2ControlByte controlByte;    controlByte.bValue = 0;    void* pData = NULL;    //Return Parameter    UEpos2ControlByte retControlByte;    retControlByte.bValue = 0;    DWORD dDeviceErrorCode = 0;    //*Variables PS*    //Parameter    BYTE uOpCode = OP_CODE;    void* pDataBuffer=NULL;    DWORD dDataBufferLength;	BYTE ubKeepLock(1);    //ReturnParameter    void* pRetDataBuffer=NULL;    DWORD dRetDataBufferLength = 0;    BOOL oResult = FALSE;    CErrorInfo comErrorInfo;    CErrorInfo cmdErrorInfo;    void* pDest;    void* pSource;    if(pCommand)    {        //Check CriticalSection		if(!IsLocked(pCommand)) return FALSE;		//GetParameterData        pCommand->GetParameterData(PARAMETER_INDEX_NODE_ID, &uNodeId, sizeof(uNodeId));        pCommand->GetParameterData(PARAMETER_INDEX_CONTROL_BYTE, &controlByte.bValue, sizeof(controlByte.bValue));        //Check Max SegmentLength        if(controlByte.structure.bLength > MAX_SEGMENT_LENGTH) controlByte.structure.bLength = MAX_SEGMENT_LENGTH;        pData = malloc(controlByte.structure.bLength);        pCommand->GetParameterData(PARAMETER_INDEX_DATA, pData, controlByte.structure.bLength);        //Prepare DataBuffer        dDataBufferLength = DATA_LENGTH + controlByte.structure.bLength;        pDataBuffer = malloc(dDataBufferLength);        //Data        pDest = pDataBuffer;        CopyData(pDest, &controlByte.bValue, sizeof(controlByte.bValue));        CopyData(pDest, pData, controlByte.structure.bLength);        //Execute Command        oResult = PS_ProcessProtocol(pProtocolStackManager, hPS_Handle, hTransactionHandle, uOpCode, pDataBuffer, dDataBufferLength, ubKeepLock, &pRetDataBuffer, &dRetDataBufferLength, &comErrorInfo);        //Check ReturnData Size        if(oResult && (dRetDataBufferLength != RETURN_DATA_LENGTH))        {            if(m_pErrorHandling) m_pErrorHandling->GetError(k_Error_MaxonSerialV1_BadDataSizeReceived, &comErrorInfo);            oResult = FALSE;        }        //ReturnData        pSource = pRetDataBuffer;        if(oResult) oResult = CopyReturnData(&dDeviceErrorCode, sizeof(dDeviceErrorCode), pSource, dRetDataBufferLength);        if(oResult) oResult = CopyReturnData(&retControlByte.bValue, sizeof(retControlByte.bValue), pSource, dRetDataBufferLength);        //Evaluate ErrorCode        oResult = EvaluateErrorCode(oResult, dDeviceErrorCode, &comErrorInfo, &cmdErrorInfo);        //Restore controlByte        if(oResult && (controlByte.structure.bToggle != retControlByte.structure.bToggle))        {            if(m_pErrorHandling) m_pErrorHandling->GetError(ERROR_DEVICE_EPOS_TOGGLE, &cmdErrorInfo);            oResult = FALSE;        }        //SetReturnParameterData        pCommand->SetStatus(oResult, &cmdErrorInfo);        pCommand->SetReturnParameterData(RETURN_PARAMETER_INDEX_ERROR_CODE, &dDeviceErrorCode, sizeof(dDeviceErrorCode));        pCommand->SetReturnParameterData(RETURN_PARAMETER_INDEX_CONTROL_BYTE, &retControlByte, sizeof(retControlByte));        //Free DataBuffer        if(pData) free(pData);//.........这里部分代码省略.........
开发者ID:RIVeR-Lab,项目名称:eposcmd,代码行数:101,


示例18: Process_ProcessProtocolMaxon

BOOL CGatewayInfoteamSerialToI::Process_ProcessProtocolMaxon(CCommand_PS* pCommand,CInterfaceManagerBase* pInterfaceManager,HANDLE hI_Handle,HANDLE hTransactionHandle){	const DWORD k_MaxPackageSize_Maxon = 256;		//*Constants PS*	const int k_ParameterIndex_PackageSize = 0;	const int k_ParameterIndex_ChunkSize = 1;	const int k_ParameterIndex_LastChunkFlag = 2;	const int k_ParameterIndex_Checksum = 3;	const int k_ParameterIndex_PackageType = 4;	const int k_ParameterIndex_OpCode = 5;	const int k_ParameterIndex_Data = 6;	const int k_ParameterIndex_KeepLock = 7;	const int k_ReturnParameterIndex_PackageSize = 0;	const int k_ReturnParameterIndex_Checksum = 1;	const int k_ReturnParameterIndex_PackageType = 2;	const int k_ReturnParameterIndex_Data = 3;	//*Variables PS*	//Parameter	DWORD dPackageSize;	WORD wChunkSize;	BYTE uLastChunkFlag;	DWORD dChecksum;	BYTE uPackageType = 0;	BYTE uOpCode = 0;	void* pDataBuffer = NULL;	DWORD dDataBufferLength;	BYTE ubKeepLock = 0;	BYTE* p = NULL;	DWORD dSize;	//ReturnParameter	DWORD dRetPackageSize;	DWORD dRetChecksum;	BYTE uRetPackageType = 0;	void* pRetDataBuffer = NULL;	DWORD dRetDataBufferLength = 0;	BOOL oResult = FALSE;	CErrorInfo errorInfo;	DWORD dTimeout;	if(pCommand && pInterfaceManager)	{		//Lock CriticalSection		if(!IsLocked(pCommand))		{			if(!Lock(pCommand)) return FALSE;		}		//Prepare DataBuffer		dDataBufferLength = pCommand->GetParameterLength(k_ParameterIndex_Data) + sizeof(uPackageType) + sizeof(uOpCode);		if(dDataBufferLength > 0) pDataBuffer = malloc(dDataBufferLength);		//Get PS Parameter Data		pCommand->GetParameterData(k_ParameterIndex_PackageSize,&dPackageSize,sizeof(dPackageSize));		pCommand->GetParameterData(k_ParameterIndex_ChunkSize,&wChunkSize,sizeof(wChunkSize));		pCommand->GetParameterData(k_ParameterIndex_LastChunkFlag,&uLastChunkFlag,sizeof(uLastChunkFlag));		pCommand->GetParameterData(k_ParameterIndex_Checksum,&dChecksum,sizeof(dChecksum));		pCommand->GetParameterData(k_ParameterIndex_KeepLock,&ubKeepLock,sizeof(ubKeepLock));		p = (BYTE*)pDataBuffer;		pCommand->GetParameterData(k_ParameterIndex_PackageType,p,sizeof(uPackageType));p+=sizeof(uPackageType);		pCommand->GetParameterData(k_ParameterIndex_OpCode,p,sizeof(uOpCode));p+=sizeof(uOpCode);		pCommand->GetParameterData(k_ParameterIndex_Data,p,pCommand->GetParameterLength(k_ParameterIndex_Data));		//Execute Command		dTimeout = pCommand->GetTimeout();		oResult = SendFrameRepeated(pInterfaceManager,hI_Handle,hTransactionHandle,dPackageSize,wChunkSize,uLastChunkFlag,&dChecksum,pDataBuffer,dDataBufferLength,&errorInfo);		if(oResult)		{			oResult = ReceiveFrameRepeated(pInterfaceManager,hI_Handle,hTransactionHandle, k_MaxPackageSize_Maxon, &dRetPackageSize,&dRetChecksum,&pRetDataBuffer,&dRetDataBufferLength,dTimeout,&errorInfo);		}		//Set PS ReturnParameter Data		pCommand->SetStatus(oResult,&errorInfo);		pCommand->SetParameterData(k_ParameterIndex_Checksum,&dChecksum,sizeof(dChecksum));		pCommand->SetReturnParameterData(k_ReturnParameterIndex_PackageSize,&dRetPackageSize,sizeof(dRetPackageSize));		pCommand->SetReturnParameterData(k_ReturnParameterIndex_Checksum,&dRetChecksum,sizeof(dRetChecksum));		if(dRetDataBufferLength > 0)		{			p = (BYTE*)pRetDataBuffer;			dSize = dRetDataBufferLength;			pCommand->SetReturnParameterData(k_ReturnParameterIndex_PackageType,p,sizeof(uRetPackageType)); p+=sizeof(uPackageType); dSize -= sizeof(uPackageType);			pCommand->SetReturnParameterData(k_ReturnParameterIndex_Data,p,dSize);		}		//Free DataBuffer		if(pDataBuffer) free(pDataBuffer);		if(pRetDataBuffer) free(pRetDataBuffer);		//Unlock CriticalSection		if(!ubKeepLock) Unlock();	}	return oResult;//.........这里部分代码省略.........
开发者ID:RIVeR-Lab,项目名称:eposcmd,代码行数:101,


示例19: IsLocked

boolMatrix<T>::Locked() const{ return IsLocked( viewType_ ); }
开发者ID:khalid-hasanov,项目名称:Elemental,代码行数:3,


示例20: GetInputAvailableType

HRESULT CHWMFT::GetInputAvailableType(    DWORD           dwInputStreamID,    DWORD           dwTypeIndex,    IMFMediaType**  ppType){    /*****************************************    ** Todo: This function will return a media    ** type at a given index. The SDK     ** implementation uses a static array of    ** media types. Your MFT may want to use    ** a dynamic array and modify the list     ** order depending on the MFTs state    ** See http://msdn.microsoft.com/en-us/library/ms704814(v=VS.85).aspx    *****************************************/    HRESULT         hr      = S_OK;    IMFMediaType*   pMT     = NULL;    do    {        if(IsLocked() != FALSE)        {            hr = MF_E_TRANSFORM_ASYNC_LOCKED;            break;        }        if(ppType == NULL)        {            hr = E_POINTER;            break;        }        /*****************************************        ** Todo: If your MFT supports more than one        ** stream, make sure you modify        ** MFT_MAX_STREAMS and adjust this function        ** accordingly        *****************************************/        if(dwInputStreamID >= MFT_MAX_STREAMS)        {            hr = MF_E_INVALIDSTREAMNUMBER;            break;        }        /*****************************************        ** Todo: Modify the accepted input list        ** g_ppguidInputTypes or use your own        ** implementation of this function        *****************************************/        if(dwTypeIndex >= g_dwNumInputTypes)        {            hr = MF_E_NO_MORE_TYPES;            break;        }        {            CAutoLock lock(&m_csLock);            hr = MFCreateMediaType(&pMT);            if(FAILED(hr))            {                break;            }            hr = pMT->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video);            if(FAILED(hr))            {                break;            }            hr = pMT->SetGUID(MF_MT_SUBTYPE, *(g_ppguidInputTypes[dwTypeIndex]));            if(FAILED(hr))            {                break;            }            (*ppType) = pMT;            (*ppType)->AddRef();        }    }while(false);    SAFERELEASE(pMT);    return hr;}
开发者ID:DMFZ,项目名称:Windows-classic-samples,代码行数:85,


示例21: return

bool FLevelModel::IsEditable() const{	return (IsLoaded() == true && IsLocked() == false);}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:4,


示例22: STDMETHOD_

	/**	 * Adds a radio distortion to the input buffer if the radio effect is enabled. 	 *	 * @param	InputProcessParameterCount	Number of elements in pInputProcessParameters.	 * @param	pInputProcessParameters		Input buffer containing audio samples. 	 * @param	OutputProcessParameterCount	Number of elements in pOutputProcessParameters. 	 * @param	pOutputProcessParameters	Output buffer, which is not touched by this xAPO. 	 * @param	IsEnabled					true if this effect is enabled; false, otherwise. 	 */	STDMETHOD_( void, Process )(	UINT32 InputProcessParameterCount,									const XAPO_PROCESS_BUFFER_PARAMETERS *pInputProcessParameters,									UINT32 OutputProcessParameterCount,									XAPO_PROCESS_BUFFER_PARAMETERS *pOutputProcessParameters,									BOOL IsEnabled )	{		// Verify several condition based on the registration 		// properties we used to create the class. 		check( IsLocked() );		check( InputProcessParameterCount == 1 );		check( OutputProcessParameterCount == 1 );		check( pInputProcessParameters[0].pBuffer == pOutputProcessParameters[0].pBuffer );		// Check the global volume multiplier because this effect 		// will continue to play if the editor loses focus.		if (IsEnabled && FApp::GetVolumeMultiplier() != 0.0f)		{			FAudioRadioEffect* RadioParameters = ( FAudioRadioEffect* )BeginProcess();			check( RadioParameters );			// The total sample size must account for multiple channels. 			const uint32 SampleSize = pInputProcessParameters[0].ValidFrameCount * WaveFormat.nChannels;			const float ChebyshevPowerMultiplier = Radio_ChebyshevPowerMultiplier->GetValueOnAnyThread();			const float ChebyshevPower = Radio_ChebyshevPower->GetValueOnAnyThread();			const float ChebyshevCubedMultiplier = Radio_ChebyshevCubedMultiplier->GetValueOnAnyThread();			const float ChebyshevMultiplier = Radio_ChebyshevMultiplier->GetValueOnAnyThread();			// If we have a silent buffer, then allocate the samples. Then, set the sample values 			// to zero to avoid getting NANs. Otherwise, the user may hear an annoying popping noise.			if( pInputProcessParameters[0].BufferFlags == XAPO_BUFFER_VALID )			{				float* SampleData = ( float* )pInputProcessParameters[0].pBuffer;				// Process each sample one at a time				for( uint32 SampleIndex = 0; SampleIndex < SampleSize; ++SampleIndex )				{					float Sample = SampleData[SampleIndex];					// Early-out of processing if the sample is zero because a zero sample 					// will still create some static even if no audio is playing.					if( Sample == 0.0f )					{						continue;					}					// Waveshape it					const float SampleCubed = Sample * Sample * Sample;					Sample = ( ChebyshevPowerMultiplier * FMath::Pow( Sample, ChebyshevPower ) ) - ( ChebyshevCubedMultiplier * SampleCubed ) + ( ChebyshevMultiplier * Sample );					// Again with the bandpass					Sample = GFinalBandPassFilter.Process( Sample );					// Store the value after done processing					SampleData[SampleIndex] = Sample;				}				EndProcess();			}		}	}
开发者ID:xiangyuan,项目名称:Unreal4,代码行数:70,


示例23: ProcessMessage

HRESULT CHWMFT::ProcessMessage(    MFT_MESSAGE_TYPE eMessage,    ULONG_PTR ulParam){    /*****************************************    ** See http://msdn.microsoft.com/en-us/library/ms701863(v=VS.85).aspx    *****************************************/    HRESULT hr = S_OK;    do    {        if(IsLocked() != FALSE)        {            hr = MF_E_TRANSFORM_ASYNC_LOCKED;            break;        }        if((m_pInputMT == NULL) || (m_pOutputMT == NULL))        {            // Can't process messages until media types are set            hr = MF_E_TRANSFORM_TYPE_NOT_SET;            break;        }        switch(eMessage)        {        case MFT_MESSAGE_NOTIFY_START_OF_STREAM:            {                hr = OnStartOfStream();                if(FAILED(hr))                {                    break;                }            }            break;        case MFT_MESSAGE_NOTIFY_END_OF_STREAM:            {                hr = OnEndOfStream();                if(FAILED(hr))                {                    break;                }            }            break;        case MFT_MESSAGE_COMMAND_DRAIN:            {                hr = OnDrain((UINT32)ulParam);                if(FAILED(hr))                {                    break;                }            }            break;        case MFT_MESSAGE_COMMAND_FLUSH:            {                hr = OnFlush();                if(FAILED(hr))                {                    break;                }            }            break;        case MFT_MESSAGE_COMMAND_MARKER:            {                hr = OnMarker(ulParam);                if(FAILED(hr))                {                    break;                }            }            break;        /************************************************        ** Todo: Add any MFT Messages that are not already        ** covered        ************************************************/        default:            // Nothing to do, return S_OK            break;        };    }while(false);    return hr;}
开发者ID:DMFZ,项目名称:Windows-classic-samples,代码行数:84,


示例24: Unlock

/// unlocks the blockfile only if it has a file that exists.  This needs to be done/// so that the unsaved ODPCMAliasBlockfiles are deleted upon exit void ODPCMAliasBlockFile::Unlock(){   if(IsSummaryAvailable() && IsLocked())      PCMAliasBlockFile::Unlock();}
开发者ID:tuanmasterit,项目名称:audacity,代码行数:7,


示例25: return

//------------------------------------------------------------------------------boolBLocker::AcquireLock(bigtime_t timeout,               status_t *error){	// By default, return no error.    *error = B_OK;	// Only try to acquire the lock if the thread doesn't already own it.    if (!IsLocked()) {	   		// Increment the benaphore count and test to see if it was already greater   		// than 0.  If it is greater than 0, then some thread already has the   		// benaphore or the style is a semaphore.  Either way, we need to acquire   		// the semaphore in this case.   		//int32 oldBenaphoreCount = atomic_add(&fBenaphoreCount, 1);   		// TODO: use atomic_inc(&fBenaphoreCount) instead   		int32 oldBenaphoreCount = atomic_add(&fBenaphoreCount, 1);   		  		if (oldBenaphoreCount > 0) {			// NOTE: "timeout" is always considered zero						*error = acquire_sem_etc(fSemaphoreID, 1,				timeout == B_INFINITE_TIMEOUT? 0 : B_RELATIVE_TIMEOUT,				timeout);   			// Note, if the lock here does time out, the benaphore count   			// is not decremented.  By doing this, the benaphore count will   			// never go back to zero.  This means that the locking essentially   			// changes to semaphore style if this was a benaphore.   			//   			// Doing the decrement of the benaphore count when the acquisition   			// fails is a risky thing to do.  If you decrement the counter at   			// the same time the thread which holds the benaphore does an   			// Unlock(), there is serious risk of a race condition.   			//   			// If the Unlock() sees a positive count and releases the semaphore   			// and then the timed out thread decrements the count to 0, there   			// is no one to take the semaphore.  The next two threads will be   			// able to acquire the benaphore at the same time!  The first will   			// increment the counter and acquire the lock.  The second will   			// acquire the semaphore and therefore the lock.  Not good.   			//   			// This has been discussed on the becodetalk mailing list and   			// Trey from Be had this to say:   			//   			// I looked at the LockWithTimeout() code, and it does not have   			// _this_ (ie the race condition) problem.  It circumvents it by   			// NOT doing the atomic_add(&count, -1) if the semaphore   			// acquisition fails.  This means that if a   			// BLocker::LockWithTimeout() times out, all other Lock*() attempts   			// turn into guaranteed semaphore grabs, _with_ the overhead of a   			// (now) useless atomic_add().   			//   			// Given Trey's comments, it looks like Be took the same approach   			// I did.  The output of CountLockRequests() of Be's implementation   			// confirms Trey's comments also.   			//   			// Finally some thoughts for the future with this code:   			//   - If 2^31 timeouts occur on a 32-bit machine (ie today),   			//     the benaphore count will wrap to a negative number.  This   			//     would have unknown consequences on the ability of the BLocker   			//     to continue to function.   			//    	}    }        // If the lock has successfully been acquired.	   	if (*error == B_NO_ERROR) {   		   		// Set the lock owner to this thread and increment the recursive count   		// by one.  The recursive count is incremented because one more Unlock()   		// is now required to release the lock (ie, 0 => 1, 1 => 2 etc).   		fLockOwner = find_thread(NULL);    	fRecursiveCount++;    }   	   	// Return true if the lock has been acquired.    return (*error == B_NO_ERROR);}
开发者ID:BackupTheBerlios,项目名称:nemo,代码行数:80,



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


C++ IsLookonMode函数代码示例
C++ IsListEmpty函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。