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


C++ CriticalSection::Leave方法代码示例

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


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

示例1: ExpandPattern

BOOL CModDoc::ExpandPattern(PATTERNINDEX nPattern)
//------------------------------------------------
{
	ROWINDEX numRows;

	if(!m_SndFile.Patterns.IsValidPat(nPattern)
		|| (numRows = m_SndFile.Patterns[nPattern].GetNumRows()) > m_SndFile.GetModSpecifications().patternRowsMax / 2)
	{
		return false;
	}

	BeginWaitCursor();
	CriticalSection cs;
	GetPatternUndo().PrepareUndo(nPattern, 0, 0, GetNumChannels(), numRows, "Expand Pattern");
	bool success = m_SndFile.Patterns[nPattern].Expand();
	cs.Leave();
	EndWaitCursor();

	if(success)
	{
		SetModified();
		UpdateAllViews(NULL, PatternHint(nPattern).Data(), NULL);
	} else
	{
		GetPatternUndo().RemoveLastUndoStep();
	}
	return success;
}
开发者ID:Sappharad,项目名称:modizer,代码行数:28,代码来源:Modedit.cpp

示例2: catch

void*           __stdcall MediaInfo_New ()
{
    #ifdef MEDIAINFO_DEBUG
        Debug_Open(false);
        Debug+=",             New, Build="; Debug+=__DATE__; Debug+=' '; Debug+=__TIME__;
        Debug_Close();
    #endif //MEDIAINFO_DEBUG

    //First init
    Critical.Enter();
    if (MI_Outputs.find(NULL)==MI_Outputs.end())
    {
        MI_Outputs[NULL]=new mi_output; //Generic Handle
    }
    Critical.Leave();

    //New
    MediaInfo* Handle=NULL;
    try
    {
        Handle=new MediaInfo;
    }
    catch(...)
    {
        MEDIAINFO_DEBUG2(   "New",
                            Debug+="!!!Exception thrown!!!";)

        delete Handle;
        return NULL;
    }
开发者ID:hiplayer,项目名称:mpc_hc,代码行数:30,代码来源:MediaInfoDLL.cpp

示例3: vldnew

// vldnew - Local helper function that actually allocates memory from VLD's
//   private heap. Prepends a header, which is used for bookkeeping information
//   that allows VLD to detect and report internal memory leaks, to the returned
//   block, but the header is transparent to the caller because the returned
//   pointer points to the usable section of memory requested by the caller, it
//   does not point to the block header.
//
//  - size (IN): Size of the memory block to be allocated.
//
//  - file (IN): Name of the file that called the new operator.
//
//  - line (IN): Line, in the above file, at which the new operator was called.
//
//  Return Value:
//
//    If the memory allocation succeeds, a pointer to the allocated memory
//    block is returned. If the allocation fails, NULL is returned.
//
void* vldnew (size_t size, const char *file, int line)
{
    vldblockheader_t *header = (vldblockheader_t*)RtlAllocateHeap(g_vldHeap, 0x0, size + sizeof(vldblockheader_t));
    static SIZE_T     serialnumber = 0;

    if (header == NULL) {
        // Out of memory.
        return NULL;
    }

    // Fill in the block's header information.
    header->file         = file;
    header->line         = line;
    header->serialNumber = serialnumber++;
    header->size         = size;

    // Link the block into the block list.
    g_vldHeapLock.Enter();
    header->next         = g_vldBlockList;
    if (header->next != NULL) {
        header->next->prev = header;
    }
    header->prev         = NULL;
    g_vldBlockList       = header;
    g_vldHeapLock.Leave();

    // Return a pointer to the beginning of the data section of the block.
    return (void*)VLDBLOCKDATA(header);
}
开发者ID:rdrago,项目名称:LCSource,代码行数:47,代码来源:vldheap.cpp

示例4: vlddelete

// vlddelete - Local helper function that actually frees memory back to VLD's
//   private heap.
//
//  - block (IN): Pointer to a memory block being freed.
//
//  Return Value:
//
//    None.
//
void vlddelete (void *block)
{
    if (block == NULL)
        return;

    BOOL              freed;
    vldblockheader_t *header = VLDBLOCKHEADER((LPVOID)block);

    // Unlink the block from the block list.
    g_vldHeapLock.Enter();
    if (header->prev) {
        header->prev->next = header->next;
    }
    else {
        g_vldBlockList = header->next;
    }

    if (header->next) {
        header->next->prev = header->prev;
    }
    g_vldHeapLock.Leave();

    // Free the block.
    freed = RtlFreeHeap(g_vldHeap, 0x0, header);
    assert(freed != FALSE);
}
开发者ID:rdrago,项目名称:LCSource,代码行数:35,代码来源:vldheap.cpp

示例5:

HANDLE 
LispThreadQueue::remove(DWORD threadID)
{
	TQCriticalSection.Enter();
	HANDLE threadHandle = 0;
	ThreadRecord* rec = 0;
	ThreadRecord** prec = &list;
	while (*prec)
	{
		if ((*prec)->threadID == threadID)
			break;
		prec = &((*prec)->next);
	}
	if ((*prec)->threadID == threadID)
	{
		rec = *prec;
		threadHandle = rec->thread;
		*prec = (*prec)->next;
		delete [] rec->QV_rec;
		delete rec;
	}
	// else error
	TQCriticalSection.Leave();
	return threadHandle;
}
开发者ID:dnm,项目名称:cormanlisp,代码行数:25,代码来源:LispThreadQueue.cpp

示例6: Stop

    bool Ignition::Stop(const char* name, const bool cancel, IgniteError* err)
    {
        bool res = false;

        factoryLock.Enter();

        if (started)
        {
            JniErrorInfo jniErr;

            SharedPointer<JniContext> ctx(JniContext::Create(NULL, 0, JniHandlers(), &jniErr));

            IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);

            if (err->GetCode() == IgniteError::IGNITE_SUCCESS)
            {
                char* name0 = CopyChars(name);

                bool res0 = ctx.Get()->IgnitionStop(name0, cancel, &jniErr);

                ReleaseChars(name0);

                IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);

                if (err->GetCode() == IgniteError::IGNITE_SUCCESS)
                    res = res0;
            }
        }

        factoryLock.Leave();

        return res;
    }
开发者ID:randall-mo,项目名称:incubator-ignite,代码行数:33,代码来源:ignition.cpp

示例7: StartTyping

static void StartTyping(MCONTACT hContact, const TalkBot::MessageInfo*)
{
	CallService(MS_PROTO_SELFISTYPING, hContact, 
		(LPARAM)PROTOTYPE_SELFTYPING_ON);
	typingContactsLock.Enter();
	typingContacts.insert(hContact);
	typingContactsLock.Leave();
}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:8,代码来源:actionQueue.cpp

示例8: TimerProc

VOID CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
{
	cs.Enter();
	QueueElement q = actionQueue.front();
	actionQueue.pop_front();
	UpdateTimer();
	cs.Leave();
	q.Handler(q.hContact, q.inf);
}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:9,代码来源:actionQueue.cpp

示例9: getPrimaryThread

ThreadRecord* LispThreadQueue::getPrimaryThread()
{
	ThreadRecord* tr = 0;
	TQCriticalSection.Enter();
	for (tr = list; tr != 0; tr = tr->next)
		if (tr->type == ThreadRecord::PrimaryThread)
			break;
	TQCriticalSection.Leave();
	return tr;
}
开发者ID:dnm,项目名称:cormanlisp,代码行数:10,代码来源:LispThreadQueue.cpp

示例10: CriticalSectionThreadFunc

unsigned long CriticalSectionThreadFunc(void* pParam)
{
	for (int i = 0; i < 10; ++i)
	{
		section.Enter();
		nCounter++;
		cout << "Critical Section Thread ID: " << reinterpret_cast<int>(pParam) << ", \t Counter: " << nCounter << endl;
		section.Leave();
	}
	return 0;
};
开发者ID:DaBianYLK,项目名称:TestProjects,代码行数:11,代码来源:MultiThreadSync.cpp

示例11: resumeAllOtherThreads

void LispThreadQueue::resumeAllOtherThreads()
{
	TQCriticalSection.Enter();
	ThreadRecord* tr = list;
	ThreadRecord* currThread = (ThreadRecord*)TlsGetValue(Thread_Index);
	while (tr)
	{
		if (tr != currThread)
			ResumeThread(tr->thread);
		tr = tr->next;
	}
	TQCriticalSection.Leave();
}
开发者ID:dnm,项目名称:cormanlisp,代码行数:13,代码来源:LispThreadQueue.cpp

示例12: GetLispThreadIDs

//
//	Given a buffer of size DWORDs, populates the buffer with
//	the thread IDs of all currently active lisp threads.
//	Returns the number of thread IDs actually stored in the buffer.
//
DWORD LispThreadQueue::GetLispThreadIDs(DWORD* buf, int size)
{
	TQCriticalSection.Enter();
	ThreadRecord* tr = list;
	int i = 0;
	while (tr && i < size)
	{
		buf[i++] = tr->threadID;
		tr = tr->next;
	}
	TQCriticalSection.Leave();
	return i;
}
开发者ID:dnm,项目名称:cormanlisp,代码行数:18,代码来源:LispThreadQueue.cpp

示例13:

//---------------------------------------------------------------------------
const wchar_t* MB2WC(void* Handle, size_t Pos, const char* Text)
{
    //Coherancy
    Critical.Enter();
    mi_inputs::iterator MI_Input=MI_Inputs.find(Handle);
    if (MI_Input==MI_Inputs.end())
    {
        MI_Inputs[Handle]=new mi_input; //Generic Handle
        MI_Input=MI_Inputs.find(Handle);
    }
    Critical.Leave();

    //Adaptation
    if (utf8)
        return MI_Input->second->Unicode[Pos].From_UTF8(Text).c_str();
    else
        return MI_Input->second->Unicode[Pos].From_Local(Text).c_str();
}
开发者ID:hiplayer,项目名称:mpc_hc,代码行数:19,代码来源:MediaInfoDLL.cpp

示例14: GetLispThreadHandle

HANDLE LispThreadQueue::GetLispThreadHandle(DWORD id)
{
	TQCriticalSection.Enter();
	ThreadRecord* tr = list;
	int i = 0;
	HANDLE ret = 0;
	while (tr)
	{
		if (id == tr->threadID)
		{
			ret = tr->thread;
			break;
		}
		tr = tr->next;
	}
	if (!tr)
		ret = 0;
	TQCriticalSection.Leave();
	return ret;
}
开发者ID:dnm,项目名称:cormanlisp,代码行数:20,代码来源:LispThreadQueue.cpp

示例15: RetrieveIconDataAsync

STDMETHODIMP DynamicDisplayItem::RetrieveIconDataAsync( IconExtractParams * theParams, void * theAsyncArg )
{
	HRESULT aRes = E_FAIL;

	CComQIPtr<IIconAcceptor> aExtr(myItem);

	if (aExtr == 0)
		return aRes;

	aRes = aExtr->RetrieveIconDataAsync(theParams, theAsyncArg);

	if ( FAILED(aRes) )
		return aRes;

	gDisplayItemCS.Enter();
	aRes = UpdateIconData(HRESULT_CODE(aRes), theParams);
	gDisplayItemCS.Leave();

	return aRes;
}
开发者ID:kerido,项目名称:koapch,代码行数:20,代码来源:DynamicDisplayItem.cpp


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