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

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

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

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

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

示例1: PrintAllocations

	void PrintAllocations( )	{		GetLock( ).lock( );#ifdef DEBUG_MEMORY		Header* header = GetBottom( )->Next;		std::string str = "/n";		while ( header )		{			if ( !header->Free )				str += "/tMEMORY LEAK/t/t" + std::string( header->File ) + ":" + std::to_string( header->Line ) + "/t/t" + std::to_string( header->Size ) + "/n";			header = header->Next;		}		header = GetTop( )->Next;		while ( header )		{			if ( !header->Free )				str += "/tMEMORY LEAK/t/t" + std::string( header->File ) + ":" + std::to_string( header->Line ) + "/t/t" + std::to_string( header->Size ) + "/n";			header = header->Next;		}		str += "/n";#if PLATFORM == PLATFORM_WINDOWS		OutputDebugStringA( str.c_str( ) );#else		printf( "%s", str.c_str( ) );#endif#endif		GetLock( ).unlock( );	}
开发者ID:Robograde,项目名称:Robograde,代码行数:31,


示例2: xnOSEnterCriticalSection

XnStatus XnSensorDepthStream::SetMirror(XnBool bIsMirrored){	XnStatus nRetVal = XN_STATUS_OK;	xnOSEnterCriticalSection(GetLock());	// set firmware mirror	XnBool bFirmwareMirror = (bIsMirrored == TRUE && m_Helper.GetFirmwareVersion() >= XN_SENSOR_FW_VER_5_0);	nRetVal = m_Helper.SimpleSetFirmwareParam(m_FirmwareMirror, (XnUInt16)bFirmwareMirror);	if (nRetVal != XN_STATUS_OK)	{		xnOSLeaveCriticalSection(GetLock());		return (nRetVal);	}	// update prop	nRetVal = XnDepthStream::SetMirror(bIsMirrored);	xnOSLeaveCriticalSection(GetLock());	XN_IS_STATUS_OK(nRetVal);	if (m_depthUtilsHandle != NULL)	{		nRetVal = DepthUtilsSetDepthConfiguration(m_depthUtilsHandle, GetXRes(), GetYRes(), GetOutputFormat(), IsMirrored());		XN_IS_STATUS_OK(nRetVal);	}	return (XN_STATUS_OK);}
开发者ID:jan-vitek,项目名称:OpenNI2,代码行数:30,


示例3: Intercept

static BOOL Intercept(THREADID tid, DEBUGGING_EVENT eventType, CONTEXT *ctxt, VOID *){    if (eventType == DEBUGGING_EVENT_BREAKPOINT)    {        // When the child thread reaches the breakpoint in Breakpoint(), wait for the main        // thread to reach the One() function.  If the main thread is not there yet, squash the        // breakpoint and move the PC back to the start of the Breakpoint() function.  This will        // delay a while and then re-trigger the breakpoint.        //        ADDRINT pc = PIN_GetContextReg(ctxt, REG_INST_PTR);        if (pc == BreakpointLocation && !AllowBreakpoint)        {            PIN_SetContextReg(ctxt, REG_INST_PTR, BreakpointFunction);            GetLock(&Lock, 1);            std::cout << "Squashing breakpoint at 0x" << std::hex << pc << " on thread " << std::dec << tid << std::endl;            ReleaseLock(&Lock);            return FALSE;        }        GetLock(&Lock, 1);        std::cout << "Stopping at breakpoint at 0x" << std::hex << pc << " on thread " << std::dec << tid << std::endl;        ReleaseLock(&Lock);        return TRUE;    }    if (eventType == DEBUGGING_EVENT_ASYNC_BREAK)    {        // When the child thread triggers the breakpoint, we should be at the One() function.        // Change the PC to the Two() function, which is the point of this test.  We want to        // make sure Pin properly handles the change of PC in this case.        //        ADDRINT pc = PIN_GetContextReg(ctxt, REG_INST_PTR);        if (pc == OneFunction)        {            PIN_SetContextReg(ctxt, REG_INST_PTR, TwoFunction);            GetLock(&Lock, 1);            std::cout << "Changing ASYNC BREAK PC to Two() on thread " << std::dec << tid << std::endl;            ReleaseLock(&Lock);            return TRUE;        }        // If the PC is not at the One() function, the child thread has probably hit some breakpoint        // other than the one at Breakpoint().  (E.g. an internal breakpoint set by GDB.)  Don't        // change the PC in such a case.        //        GetLock(&Lock, 1);        std::cout << "ASYNC_BREAK at 0x" << std::hex << pc << " on thread " << std::dec << tid << std::endl;        ReleaseLock(&Lock);        return TRUE;    }    GetLock(&Lock, 1);    std::cout << "FAILURE: Unexpected debugging event type" << std::endl;    ReleaseLock(&Lock);    std::exit(1);}
开发者ID:alagenchev,项目名称:school_code,代码行数:56,


示例4: add_or_update_alarm

int add_or_update_alarm(uint8_t hour, uint8_t min, uint8_t mode,                         uint8_t repeat_factor, char *name){    pthread_mutex_t *bucket_mtx = GetLock(hour, min);    pthread_mutex_lock(bucket_mtx);    AlarmClockInfo *header = GetHeader(hour, min);    AlarmClockInfo *temp = header;    // Check whether an existing entry should be updated    while (temp)    {        if (temp->hour == hour && temp->min == min)        {            temp->mode = mode;            temp->repeat_factor = repeat_factor;            strcpy(temp->name, name);            pthread_mutex_unlock(bucket_mtx);            return 0;        }        temp = temp->next;    }    // A new entry is inserted    AlarmClockInfo *naci = CreateNewInfo(hour,min,mode,repeat_factor,name);    naci->next = header;    *AC_TABLE_ENTRY(hour,min) = naci;    pthread_mutex_unlock(bucket_mtx);    return 1;}
开发者ID:Milchdealer,项目名称:Atlas,代码行数:27,


示例5: cancel_alarm

// Return 1 if found and removed, otherwise return 0int cancel_alarm(uint8_t hour, uint8_t min, int play){    pthread_mutex_t *bucket_mtx = GetLock(hour, min);    pthread_mutex_lock(bucket_mtx);    AlarmClockInfo *cand = GetHeader(hour, min);    AlarmClockInfo *prev = NULL;    while (cand)    {        if (cand->hour == hour && cand->min == min)        {            // Optionally, play the alarm here before essentially removing it            // ...                if (play)                ; // sound an alarm            if (!prev) *AC_TABLE_ENTRY(hour, min) = cand->next;            else prev->next = cand->next;            free(cand);            pthread_mutex_unlock(bucket_mtx);            return 1;        }        prev = cand;        cand = cand->next;    }    pthread_mutex_unlock(bucket_mtx);    return 0;}
开发者ID:Milchdealer,项目名称:Atlas,代码行数:28,


示例6: GetLock

//-----------------------------------------// функция логирует события мыши//-----------------------------------------bool TKeyLogger::LogMouse(HWND Wnd, int X, int Y, int Button){	//------  блокируем код --------	TLock L = GetLock();	//------------------------------	return true;}
开发者ID:0x00dec0de,项目名称:Carberp,代码行数:10,


示例7: GetPlayerDataCache

void AccountMgr::ClearPlayerDataCache(ObjectGuid guid){    if (!guid || !guid.IsPlayer())        return;    PlayerDataCache const* cache = GetPlayerDataCache(guid, false);    if (cache)    {        uint32 accId = cache->account;        WriteGuard Guard(GetLock());        PlayerDataCacheMap::iterator itr = mPlayerDataCacheMap.find(guid);        if (itr != mPlayerDataCacheMap.end())            mPlayerDataCacheMap.erase(itr);        RafLinkedMap::iterator itr1 = mRAFLinkedMap.find(std::pair<uint32,bool>(accId, true));        if (itr1 != mRAFLinkedMap.end())            mRAFLinkedMap.erase(itr1);        itr1 = mRAFLinkedMap.find(std::pair<uint32,bool>(accId, false));        if (itr1 != mRAFLinkedMap.end())            mRAFLinkedMap.erase(itr1);    }}
开发者ID:AnthoDevMoP,项目名称:mangos4,代码行数:25,


示例8: NOW

RafLinkedList* AccountMgr::GetRAFAccounts(uint32 accid, bool referred){    RafLinkedMap::iterator itr = mRAFLinkedMap.find(std::pair<uint32,bool>(accid, referred));    if (itr == mRAFLinkedMap.end())    {        QueryResult* result;        if (referred)            result = LoginDatabase.PQuery("SELECT `friend_id` FROM `account_friends` WHERE `id` = %u AND `expire_date` > NOW() LIMIT %u", accid, sWorld.getConfig(CONFIG_UINT32_RAF_MAXREFERERS));        else            result = LoginDatabase.PQuery("SELECT `id` FROM `account_friends` WHERE `friend_id` = %u AND `expire_date` > NOW() LIMIT %u", accid, sWorld.getConfig(CONFIG_UINT32_RAF_MAXREFERALS));        RafLinkedList acclist;        if (result)        {            do            {                Field* fields = result->Fetch();                uint32 refaccid = fields[0].GetUInt32();                acclist.push_back(refaccid);            }            while (result->NextRow());            delete result;        }        ReadGuard Guard(GetLock());        mRAFLinkedMap.insert(RafLinkedMap::value_type(std::pair<uint32,bool>(accid, referred), acclist));        itr = mRAFLinkedMap.find(std::pair<uint32,bool>(accid, referred));    }    return &itr->second;}
开发者ID:AnthoDevMoP,项目名称:mangos4,代码行数:33,


示例9: BeforeMalloc

// This routine is executed each time malloc is called.VOID BeforeMalloc( int size, THREADID threadid ){    GetLock(&lock, threadid+1);    fprintf(out, "thread %d entered malloc(%d)/n", threadid, size);    fflush(out);    ReleaseLock(&lock);}
开发者ID:gungun1010,项目名称:hidden,代码行数:8,


示例10: main

int main(int argc, char **argv){   if(InitLocks("qlite", "sapc13", 5468))   {      if(GetLock(1, 5)==0)         printf("Got lock!/n");      else         printf("Lock denied!/n");/*      if(GetLock(1, 5)==0)         printf("Got lock!/n");      else         printf("Lock denied!/n");      if(ReleaseLock(1))         printf("Lock released!/n");      else         printf("Couldn't release lock!/n");      if(GetLock(1, 5)==0)         printf("Got lock!/n");      else         printf("Lock denied!/n");      if(ReleaseLock(2))         printf("Lock released!/n");      else         printf("Couldn't release lock!/n");*/   }   return(0);}
开发者ID:AndrewCRMartin,项目名称:qlite,代码行数:34,


示例11: ThreadStart

// Note that opening a file in a callback is only supported on Linux systems.// See buffer-win.cpp for how to work around this issue on Windows.//// This routine is executed every time a thread is created.VOID ThreadStart(THREADID threadid, CONTEXT *ctxt, INT32 flags, VOID *v){    GetLock(&lock, threadid+1);    fprintf(out, "thread begin %d/n",threadid);    fflush(out);    ReleaseLock(&lock);}
开发者ID:gungun1010,项目名称:hidden,代码行数:11,


示例12: lock

T* HashMapHolder<T>::Find(ObjectGuid guid){    boost::shared_lock<boost::shared_mutex> lock(*GetLock());    typename MapType::iterator itr = GetContainer().find(guid);    return (itr != GetContainer().end()) ? itr->second : NULL;}
开发者ID:Diyvol,项目名称:TrinityCore,代码行数:7,


示例13: cCS0

intC_File::AddLock( LockStruct *ls, BOOL bWait ){	C_FileCritSect	cCS0( this, CRITSECT0 );	LockStruct *lsAux = GetLock( ls );	if( lsAux ){		lsAux->iCount++;		if( ls ){			delete ls;		}		return( OK );	} else {		if( !IsLocked( ls, TRUE ) ){			ls->iCount++;			if( _LockTable [ iLine ]->Add( ls, TAIL ) == OK ){				if( RealLock( ls, bWait ) == OK ){					return( OK );				} else {					_LockTable [ iLine ]->Refresh( NULL );					_LockTable [ iLine ]->Del();				}			}		}	}	return( !OK );}
开发者ID:softwarepublico,项目名称:lightbase,代码行数:26,


示例14: locker

void OPFResource::AddSigilVersionMeta(){    QWriteLocker locker(&GetLock());    QString source = CleanSource::ProcessXML(GetText(),"application/oebps-package+xml");    OPFParser p;    p.parse(source);    for (int i=0; i < p.m_metadata.count(); ++i) {        MetaEntry me = p.m_metadata.at(i);        if ((me.m_name == "meta") && (me.m_atts.contains("name"))) {              QString name = me.m_atts[QString("name")];            if (name == SIGIL_VERSION_META_NAME) {                me.m_atts["content"] = QString(SIGIL_VERSION);                p.m_metadata.replace(i, me);                UpdateText(p);                return;            }        }    }    MetaEntry me;    me.m_name = "meta";    me.m_atts[QString("name")] = QString("Sigil version");    me.m_atts[QString("content")] = QString(SIGIL_VERSION);    p.m_metadata.append(me);    UpdateText(p);}
开发者ID:wrCisco,项目名称:Sigil,代码行数:25,


示例15: Image

VOID  Image(IMG img, VOID *v){        char    szFilePath[260];        unsigned long index;                GetLock(&lock, 1);        if (process_start != 0){                ReleaseLock(&lock);                return;        }        if (IMG_Valid(img)){                memset(szFilePath, 0, sizeof(szFilePath));                strncpy(szFilePath, IMG_Name(img).c_str(), sizeof(szFilePath)-1);                index = 0;                while (szFilePath[index] != 0){                        szFilePath[index] = tolower(szFilePath[index]);                        index++;                }                                if (strstr(szFilePath, KnobProcessToTrace.Value().c_str())){                        process_start = IMG_LowAddress(img);                        process_end   = IMG_HighAddress(img);                }        }        ReleaseLock(&lock);        }
开发者ID:IDA-RE-things,项目名称:IDA-pinlog,代码行数:26,


示例16: Fini

/*! * Print out analysis results. * This function is called when the application exits. * @param[in]   code            exit code of the application * @param[in]   v               value specified by the tool in the  *                              PIN_AddFiniFunction function call */VOID Fini(INT32 code, VOID *v){    GetLock(&fileLock, 1);    fclose(outfile);    printf("outfile closed/n");    ReleaseLock(&fileLock);}
开发者ID:gungun1010,项目名称:hidden,代码行数:14,


示例17: ThreadFini

// This routine is executed every time a thread is destroyed.VOID ThreadFini(THREADID threadid, const CONTEXT *ctxt, INT32 code, VOID *v){    GetLock(&lock, threadid+1);    fprintf(out, "thread end %d code %d/n",threadid, code);    fflush(out);    ReleaseLock(&lock);}
开发者ID:gungun1010,项目名称:hidden,代码行数:8,


示例18: DEBUG_FILTER_LOG

// call this method onlyvoid TerrainInfo::CleanUpGrids(uint32 const diff){    for (int y = 0; y < MAX_NUMBER_OF_GRIDS; ++y)    {        for (int x = 0; x < MAX_NUMBER_OF_GRIDS; ++x)        {            // delete those GridMap objects which have refcount == 0            if (m_GridMaps[x][y] && m_GridMaps[x][y].count() == 0)            {                DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING,"TerrainInfo::CleanUpGrids unload grid map:%u x:%d y:%d", GetMapId(), x, y);                WriteGuard Guard(GetLock(), true);                GridMapPtr tmpPtr = m_GridMaps[x][y];                m_GridMaps[x][y] = GridMapPtr();                // unload VMAPS...                VMAP::VMapFactory::createOrGetVMapManager()->unloadMap(m_mapId, x, y);                // unload mmap...                MMAP::MMapFactory::createOrGetMMapManager()->unloadMap(m_mapId, x, y);                // tmpPtr be auto-erased after cycle end            }        }    }}
开发者ID:Jojo2323,项目名称:mangos3,代码行数:27,


示例19: locker

void TextResource::InitialLoad(){    /**      * Stuff to know about resource loading...      *      * Currently Sigil when opening an ePub creates Resource objects *prior*      * to actually copying the resources from the zip into the Sigil folders.      * So in 99% of cases the resource will not exist, so a call to InitialLoad()      * from the constructor would fail (which it used to do).      *      * For some resource types there is a call made afterwards which will result      * in the resource being loaded such as for HTML files, CSS, NCX and OPF      * (see UniversalUpdates.cpp and code setting default text for new html pages etc).      *      * For other text resource types, they will only get loaded on demand, when      * the tab is actually opened, TextTab.cpp will call this InitialLoad() function.      *      * If you were to write some code to iterate over resources that do not fall      * into the special cases above, you *must* call InitialLoad() first to ensure      * the data is loaded, or else it will be blank or have data depending on whether      * it had been opened in a tab first.      */    QWriteLocker locker(&GetLock());    Q_ASSERT(m_TextDocument);    if (m_TextDocument->toPlainText().isEmpty() && QFile::exists(GetFullPath())) {        SetText(Utility::ReadUnicodeTextFile(GetFullPath()));    }}
开发者ID:AmesianX,项目名称:Sigil,代码行数:29,


示例20: Error

VOID Error(std::string where, THREADID tid, UINT32 r, ADDRINT expect, ADDRINT val){    GetLock(&Lock, 1);    Out << "Mismatch " << where << ": tid=" << std::dec << tid << " (G" << r << ")" <<        ", Expect " << std::hex << expect << ", Got " << std::hex << val << std::endl;    ReleaseLock(&Lock);}
开发者ID:dcashman,项目名称:Coursework,代码行数:7,


示例21: ThreadBegin

VOID ThreadBegin(UINT32 threadid, VOID * sp, int flags, VOID *v){    GetLock(&lock, threadid+1);    numThreads++;    ReleaseLock(&lock);        ASSERT(numThreads <= MaxNumThreads, "Maximum number of threads exceeded/n");}
开发者ID:aarony,项目名称:arm-v7a-pintool,代码行数:8,


示例22: GridMapPtr

GridMapPtr TerrainInfo::GetGridMap(uint32 const& x, uint32 const& y){    if (x >= MAX_NUMBER_OF_GRIDS || y >= MAX_NUMBER_OF_GRIDS)        return GridMapPtr();    ReadGuard Guard(GetLock(), true);    return m_GridMaps[x][y];}
开发者ID:Jojo2323,项目名称:mangos3,代码行数:8,


示例23: guard

void EventMgr::SetState(int eventId, LuaEventState state){    Guard guard(GetLock());    if (!processors.empty())        for (ProcessorSet::const_iterator it = processors.begin(); it != processors.end(); ++it) // loop processors            (*it)->SetState(eventId, state);    globalProcessor->SetState(eventId, state);}
开发者ID:mangosthree,项目名称:server,代码行数:8,


示例24: ThreadStart

VOID ThreadStart(THREADID threadid, CONTEXT *ctxt, INT32 flags, VOID *v){    GetLock(&lock, threadid+1);    numThreads++;    ReleaseLock(&lock);        ASSERT(numThreads <= MaxNumThreads, "Maximum number of threads exceeded/n");}
开发者ID:andrewjinyounglee,项目名称:PerVERT,代码行数:8,


示例25: lock

void EventMgr::RemoveEvent(int eventId){    ReadGuard lock(GetLock());    if (!processors.empty())        for (ProcessorSet::const_iterator it = processors.begin(); it != processors.end(); ++it) // loop processors            (*it)->RemoveEvent(eventId);    globalProcessor->RemoveEvent(eventId);}
开发者ID:GlassFace,项目名称:trinitycore-1,代码行数:8,


示例26: RenewEvents

void WorldObjectEventProcessor::Update(uint32 p_time, bool force){    if (force)        RenewEvents();    ReadGuard Guard(GetLock());    EventProcessor::Update(p_time);}
开发者ID:klyxmaster,项目名称:mangos,代码行数:8,


示例27: backend_refresh_cache_thread

/** * backend_refresh_cache_thread: */static gbooleanbackend_refresh_cache_thread (PkBackend *backend){	pk_backend_set_allow_cancel (backend, true);	aptcc *m_apt = new aptcc(backend, _cancel);	pk_backend_set_pointer(backend, "aptcc_obj", m_apt);	if (m_apt->init()) {		egg_debug ("Failed to create apt cache");		delete m_apt;		pk_backend_finished (backend);		return false;	}	pk_backend_set_status (backend, PK_STATUS_ENUM_REFRESH_CACHE);	// Lock the list directory	FileFd Lock;	if (_config->FindB("Debug::NoLocking", false) == false)	{		Lock.Fd(GetLock(_config->FindDir("Dir::State::Lists") + "lock"));		if (_error->PendingError() == true) {			pk_backend_error_code (backend, PK_ERROR_ENUM_CANNOT_GET_LOCK, "Unable to lock the list directory");			delete m_apt;			pk_backend_finished (backend);			return false;	// 	 return _error->Error(_("Unable to lock the list directory"));		}	}	// Create the progress	AcqPackageKitStatus Stat(m_apt, backend, _cancel);	// do the work	if (_config->FindB("APT::Get::Download",true) == true) {		ListUpdate(Stat, *m_apt->packageSourceList);	}	// Rebuild the cache.	pkgCacheFile Cache;	OpTextProgress Prog(*_config);	if (Cache.BuildCaches(Prog, true) == false) {		if (_error->PendingError() == true) {			show_errors(backend, PK_ERROR_ENUM_CANNOT_GET_LOCK);		}		delete m_apt;		pk_backend_finished (backend);		return false;	}	// missing gpg signature would appear here	// TODO we need a better enum	if (_error->PendingError() == false && _error->empty() == false) {		show_warnings(backend, PK_MESSAGE_ENUM_UNTRUSTED_PACKAGE);	}	pk_backend_finished (backend);	delete m_apt;	return true;}
开发者ID:zodman,项目名称:PackageKit,代码行数:61,


示例28: ThreadFini

VOID ThreadFini(THREADID tid, const CONTEXT *ctxt, INT32 code, VOID *v){    // When the thread exits, accumulate the thread's dynamic instruction    // count into the total.    //    GetLock(&Lock, tid+1);    TotalCount += PIN_GetContextReg(ctxt, ScratchReg);    ReleaseLock(&Lock);}
开发者ID:alagenchev,项目名称:school_code,代码行数:9,



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


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