本文整理汇总了C++中IsLocked函数的典型用法代码示例。如果您正苦于以下问题:C++ IsLocked函数的具体用法?C++ IsLocked怎么用?C++ IsLocked使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsLocked函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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();
}
}
}
示例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;
}
示例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;
}
示例5: MOZ_ASSERT_UNREACHABLE
void
DecodedSurfaceProvider::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();
}
示例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();
}
}
示例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() );
}
}
示例8:
//------------------------------------------------------------------------------
void
BLocker::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);
}
}
}
}
示例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;
}
示例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);
}
示例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();}
示例12: wxRemoveFile
BlockFile::~BlockFile()
{
if (!IsLocked() && mFileName.HasName())
wxRemoveFile(mFileName.GetFullPath());
}
示例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;
}
示例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 ) );
}
示例15: DebugAssertTrue
void UScheduler::Timer::SetTimeout(U32 timeout)
{
DebugAssertTrue(IsLocked());
_timeoutTime = System::GetTickCount() + timeout;
AddOperationWithTimeout(_node);
}