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


C++ Unlock函数代码示例

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


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

示例1: Lock

bool CGPSController::IsKnownPosition() {
	Lock();
	bool ret = m_knownPosition;
	Unlock();
	return ret;
}
开发者ID:sumitk,项目名称:rhodes,代码行数:6,代码来源:GeoLocationImpl.cpp

示例2: Unlock

AppInstance::~AppInstance()
{
  try {
    Unlock();
  } catch (AppInstException e) {}
}
开发者ID:wankdanker,项目名称:svn.aiken.cz,代码行数:6,代码来源:appinst.cpp

示例3: Unlock

HGLOBAL MGlobal::Detach()
{
	Unlock();
	HGLOBAL p = (HGLOBAL)InterlockedExchangePointer((PVOID*)&mh_Global, NULL);
	return p;
}
开发者ID:1833183060,项目名称:ConEmu,代码行数:6,代码来源:MGlobal.cpp

示例4: while

void
OHCI::_FinishTransfers()
{
	while (!fStopFinishThread) {
		if (acquire_sem(fFinishTransfersSem) < B_OK)
			continue;

		// eat up sems that have been released by multiple interrupts
		int32 semCount = 0;
		get_sem_count(fFinishTransfersSem, &semCount);
		if (semCount > 0)
			acquire_sem_etc(fFinishTransfersSem, semCount, B_RELATIVE_TIMEOUT, 0);

		if (!Lock())
			continue;

		TRACE("finishing transfers (first transfer: %p; last"
			" transfer: %p)\n", fFirstTransfer, fLastTransfer);
		transfer_data *lastTransfer = NULL;
		transfer_data *transfer = fFirstTransfer;
		Unlock();

		while (transfer) {
			bool transferDone = false;
			ohci_general_td *descriptor = transfer->first_descriptor;
			ohci_endpoint_descriptor *endpoint = transfer->endpoint;
			status_t callbackStatus = B_OK;

			MutexLocker endpointLocker(endpoint->lock);

			if ((endpoint->head_physical_descriptor & OHCI_ENDPOINT_HEAD_MASK)
				!= endpoint->tail_physical_descriptor) {
				// there are still active transfers on this endpoint, we need
				// to wait for all of them to complete, otherwise we'd read
				// a potentially bogus data toggle value below
				TRACE("endpoint %p still has active tds\n", endpoint);
				lastTransfer = transfer;
				transfer = transfer->link;
				continue;
			}

			endpointLocker.Unlock();

			while (descriptor && !transfer->canceled) {
				uint32 status = OHCI_TD_GET_CONDITION_CODE(descriptor->flags);
				if (status == OHCI_TD_CONDITION_NOT_ACCESSED) {
					// td is still active
					TRACE("td %p still active\n", descriptor);
					break;
				}

				if (status != OHCI_TD_CONDITION_NO_ERROR) {
					// an error occured, but we must ensure that the td
					// was actually done
					if (endpoint->head_physical_descriptor & OHCI_ENDPOINT_HALTED) {
						// the endpoint is halted, this guaratees us that this
						// descriptor has passed (we don't know if the endpoint
						// was halted because of this td, but we do not need
						// to know, as when it was halted by another td this
						// still ensures that this td was handled before).
						TRACE_ERROR("td error: 0x%08lx\n", status);

						switch (status) {
							case OHCI_TD_CONDITION_CRC_ERROR:
							case OHCI_TD_CONDITION_BIT_STUFFING:
							case OHCI_TD_CONDITION_TOGGLE_MISMATCH:
								callbackStatus = B_DEV_CRC_ERROR;
								break;

							case OHCI_TD_CONDITION_STALL:
								callbackStatus = B_DEV_STALLED;
								break;

							case OHCI_TD_CONDITION_NO_RESPONSE:
								callbackStatus = B_TIMED_OUT;
								break;

							case OHCI_TD_CONDITION_PID_CHECK_FAILURE:
								callbackStatus = B_DEV_BAD_PID;
								break;

							case OHCI_TD_CONDITION_UNEXPECTED_PID:
								callbackStatus = B_DEV_UNEXPECTED_PID;
								break;

							case OHCI_TD_CONDITION_DATA_OVERRUN:
								callbackStatus = B_DEV_DATA_OVERRUN;
								break;

							case OHCI_TD_CONDITION_DATA_UNDERRUN:
								callbackStatus = B_DEV_DATA_UNDERRUN;
								break;

							case OHCI_TD_CONDITION_BUFFER_OVERRUN:
								callbackStatus = B_DEV_FIFO_OVERRUN;
								break;

							case OHCI_TD_CONDITION_BUFFER_UNDERRUN:
								callbackStatus = B_DEV_FIFO_UNDERRUN;
								break;
//.........这里部分代码省略.........
开发者ID:mmanley,项目名称:Antares,代码行数:101,代码来源:ohci.cpp

示例5: Unlock

		~MessengerAutoLocker()
		{
			Unlock();
		}
开发者ID:axeld,项目名称:driveencryption,代码行数:4,代码来源:PaneSwitch.cpp

示例6: m_BSM_Init


//.........这里部分代码省略.........
	//	hr = CVR_EscapeCtrl(m_pVr,TITAN_DSP_RENDERER,0,0,0);
	//	if(hr!=VR_OK)
	//	{
	//		// do something here.
	//	}
	//}
	//else
	{
//		alignx = 2; /* actually 2, but we prefer this for our averaging ops */
//		aligny = 2;

	}
	buffers = m_dwMaxBuffers+1;
	wpad = ~(m_dwWidth-1) & (ALIGNX-1);
	width = m_dwWidth+wpad;
	height = m_dwHeight*m_sy;
	hpad = ~(height-1) & (ALIGNY-1);
	height = height+hpad;
	//width = width + (width&0xf);
	//height = height + (height&0xf);
	//SetDisplayMode(1);


	m_iYPitch = width;
	m_iUVPitch = m_iYPitch>>1;
	//hr = CVR_SetVideoFormat(m_pVr, 0, width, height, 0, &m_iYPitch, &m_iUVPitch);
		//Set the Video parameters. 
	//VR_FORMAT_I420: set the input data format as I420  
	//width: width of source frame 
	//height: height of source frame 
	//rect: the source rect 
	//LumPitch: pitch of lum 
	//ChromPitch: pitch of chrom 

	width = ROOF(m_dwWidth, ALIGNX);

	if(m_bBSMMode == TRUE)
		height = ROOF(m_dwHeight, ALIGNY);
	else
		height = m_dwHeight;

	VR_SRCRECT rect;
	rect.left= 0;
	rect.right = m_dwWidth;
	rect.top = 0;
	rect.bottom= m_dwHeight;

	hr = m_CVR_SetVideoFormat(m_pVr, VR_FORMAT_I420, width, height, &rect,  &m_iYPitch, &m_iUVPitch);

	SetDeinterlaceMode(m_deinterlace_mode);

    if(!m_bBSMMode)
    {
	    m_pBackBuffer = new LPVR_FRAME_SURFACE[buffers];
	    ZeroMemory(m_pBackBuffer,sizeof(m_pBackBuffer[0])*buffers);

	    for(i=0;i<(signed)buffers;i++)
	    {
		    hr = m_CVR_CreateSurface(m_pVr,&m_pBackBuffer[i],1);
		    if(hr!=VR_OK)
			    break;
	    }
	    if(i==0)
	    {
		    delete[] m_pBackBuffer;
		    m_pBackBuffer = 0;
		    //CVR_DeleteVideoRender(m_pVr);
		    //m_pVr = 0;
		    return E_FAIL;
	    }

	    if(i>1)
	    {		// make sure we have at least one surface available for background scratch, otherwise hang.
		    m_CVR_DestroySurface(m_pVr,m_pBackBuffer[--i]);
		    ZeroMemory(&m_pBackBuffer[i],sizeof(m_pBackBuffer[i]));
	    }

	    m_dwBackBuffers = i;

	    // clear out buffers
	    unsigned char *pb;
	    LONG lstride;
	    int xl,xr,yt,yb,ht;

	    yt = hpad>>1&~1;
	    yb = hpad - yt;
	    xl = 0; // (wpad>>1)&~3;
	    xr = wpad -xl;
	    ht = m_dwHeight*m_sy;

	    for(i=0;i<(signed)m_dwBackBuffers;i++)
	    {
		    if(SUCCEEDED(Lock(i, (LPVOID *)&pb, &lstride, 0)))
		    {
			    clearoutsiderect(pb,m_dwWidth,ht,lstride,0,xl,xr,yt,yb);
			    clearoutsiderect(pb+height*width,m_dwWidth>>1,ht>>1,lstride>>1,128,xl>>1,xr>>1,yt>>1,yb>>1);
			    clearoutsiderect(pb+height*width+(height*width>>2),m_dwWidth>>1,ht>>1,lstride>>1,128,xl>>1,xr>>1,yt>>1,yb>>1);
			    Unlock(i);
		    }
	    }
开发者ID:xuweiqiang,项目名称:LibVRPresent,代码行数:101,代码来源:GfxTitanII.cpp

示例7: Lock

void CDVDPerformanceCounter::DeInitialize()
{
  Lock();
  
  Unlock();
}
开发者ID:Avoidnf8,项目名称:xbmc-fork,代码行数:6,代码来源:DVDPerformanceCounter.cpp

示例8: NazaraError

bool NzRenderTexture::AttachBuffer(nzAttachmentPoint attachmentPoint, nzUInt8 index, nzPixelFormat format)
{
	#if NAZARA_RENDERER_SAFE
	if (!m_impl)
	{
		NazaraError("Render texture not created");
		return false;
	}

	if (attachmentPoint != nzAttachmentPoint_Color && index > 0)
	{
		NazaraError("Index must be 0 for non-color attachments");
		return false;
	}

	unsigned int depthStencilIndex = attachmentIndex[nzAttachmentPoint_DepthStencil];
	if (attachmentPoint == nzAttachmentPoint_Stencil && m_impl->attachements.size() > depthStencilIndex &&
		m_impl->attachements[depthStencilIndex].isUsed)
	{
		NazaraError("Stencil target already attached by DepthStencil attachment");
		return false;
	}

	if (formatTypeToAttachment[NzPixelFormat::GetType(format)] != attachmentPoint)
	{
		NazaraError("Pixel format type does not match attachment point type");
		return false;
	}
	#endif

	NzOpenGL::Format openglFormat;
	if (!NzOpenGL::TranslateFormat(format, &openglFormat, NzOpenGL::FormatType_RenderBuffer))
	{
		NazaraError("Failed to translate pixel format into OpenGL format");
		return false;
	}

	if (!Lock())
	{
		NazaraError("Failed to lock render texture");
		return false;
	}

	// Détachement de l'attache précédente (Si il y a)
	Detach(attachmentPoint, index);

	GLuint renderBuffer = 0;

	glGenRenderbuffers(1, &renderBuffer);
	if (!renderBuffer)
	{
		NazaraError("Failed to create renderbuffer");
		return false;
	}

	GLint previous;
	glGetIntegerv(GL_RENDERBUFFER_BINDING, &previous);

	glBindRenderbuffer(GL_RENDERBUFFER, renderBuffer);
	glRenderbufferStorage(GL_RENDERBUFFER, openglFormat.internalFormat, m_impl->width, m_impl->height);

	if (previous != 0)
		glBindRenderbuffer(GL_RENDERBUFFER, previous);

	glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, NzOpenGL::Attachment[attachmentPoint]+index, GL_RENDERBUFFER, renderBuffer);
	Unlock();

	unsigned int minSize = attachmentIndex[attachmentPoint]+index+1;
	if (m_impl->attachements.size() < minSize)
		m_impl->attachements.resize(minSize);

	Attachment& attachment = m_impl->attachements[minSize-1];
	attachment.isBuffer = true;
	attachment.isUsed = true;
	attachment.buffer = renderBuffer;

	m_impl->checked = false;
	m_impl->drawBuffersUpdated = false;

	return true;
}
开发者ID:ljurado,项目名称:NazaraEngine,代码行数:81,代码来源:RenderTexture.cpp

示例9: AddLocalBridge

// Add a local-bridge
void AddLocalBridge(CEDAR *c, char *hubname, char *devicename, bool local, bool monitor, bool tapmode, char *tapaddr, bool limit_broadcast)
{
	UINT i;
	HUB *h = NULL;
	LOCALBRIDGE *br = NULL;
	// Validate arguments
	if (c == NULL || hubname == NULL || devicename == NULL)
	{
		return;
	}

	if (OS_IS_UNIX(GetOsInfo()->OsType) == false)
	{
		tapmode = false;
	}

	LockList(c->HubList);
	{
		LockList(c->LocalBridgeList);
		{
			bool exists = false;

			// Ensure that the same configuration local-bridge doesn't exist already 
			for (i = 0;i < LIST_NUM(c->LocalBridgeList);i++)
			{
				LOCALBRIDGE *br = LIST_DATA(c->LocalBridgeList, i);
				if (StrCmpi(br->DeviceName, devicename) == 0)
				{
					if (StrCmpi(br->HubName, hubname) == 0)
					{
						if (br->TapMode == tapmode)
						{
							exists = true;
						}
					}
				}
			}

			if (exists == false)
			{
				// Add configuration
				br = ZeroMalloc(sizeof(LOCALBRIDGE));
				StrCpy(br->HubName, sizeof(br->HubName), hubname);
				StrCpy(br->DeviceName, sizeof(br->DeviceName), devicename);
				br->Bridge = NULL;
				br->Local = local;
				br->TapMode = tapmode;
				br->LimitBroadcast = limit_broadcast;
				br->Monitor = monitor;
				if (br->TapMode)
				{
					if (tapaddr != NULL && IsZero(tapaddr, 6) == false)
					{
						Copy(br->TapMacAddress, tapaddr, 6);
					}
					else
					{
						GenMacAddress(br->TapMacAddress);
					}
				}

				Add(c->LocalBridgeList, br);

				// Find the hub
				for (i = 0;i < LIST_NUM(c->HubList);i++)
				{
					HUB *hub = LIST_DATA(c->HubList, i);
					if (StrCmpi(hub->Name, br->HubName) == 0)
					{
						h = hub;
						AddRef(h->ref);
						break;
					}
				}
			}
		}
		UnlockList(c->LocalBridgeList);
	}
	UnlockList(c->HubList);

	// Start the local-bridge immediately
	if (h != NULL && br != NULL && h->Type != HUB_TYPE_FARM_DYNAMIC)
	{
		Lock(h->lock_online);
		{
			if (h->Offline == false)
			{
				LockList(c->LocalBridgeList);
				{
					if (IsInList(c->LocalBridgeList, br))
					{
						if (br->Bridge == NULL)
						{
							br->Bridge = BrNewBridge(h, br->DeviceName, NULL, br->Local, br->Monitor, br->TapMode, br->TapMacAddress, br->LimitBroadcast, br);
						}
					}
				}
				UnlockList(c->LocalBridgeList);
			}
//.........这里部分代码省略.........
开发者ID:13eatrice,项目名称:SoftEtherVPN,代码行数:101,代码来源:Bridge.c

示例10: ReadOnlyDeleteMode

ShellDelete::ShellDelete(Panel *SrcPanel,bool Wipe):
	ReadOnlyDeleteMode(-1),
	m_SkipMode(-1),
	SkipWipeMode(-1),
	SkipFoldersMode(-1),
	ProcessedItems(0)
{
	SCOPED_ACTION(ChangePriority)(Global->Opt->DelThreadPriority);
	SCOPED_ACTION(TPreRedrawFuncGuard)(std::make_unique<DelPreRedrawItem>());
	os::FAR_FIND_DATA FindData;
	string strDeleteFilesMsg;
	string strSelName;
	string strSelShortName;
	string strDizName;
	DWORD FileAttr;
	size_t SelCount;
	int UpdateDiz;
	int DizPresent;
	int Ret;
	BOOL NeedUpdate=TRUE, NeedSetUpADir=FALSE;
	bool Opt_DeleteToRecycleBin=Global->Opt->DeleteToRecycleBin;
	/*& 31.05.2001 OT Запретить перерисовку текущего окна*/
	auto WindowFromLaunched = Global->WindowManager->GetCurrentWindow();
	WindowFromLaunched->Lock();
	bool DeleteAllFolders=!Global->Opt->Confirm.DeleteFolder;
	UpdateDiz=(Global->Opt->Diz.UpdateMode==DIZ_UPDATE_ALWAYS ||
	           (SrcPanel->IsDizDisplayed() &&
	            Global->Opt->Diz.UpdateMode==DIZ_UPDATE_IF_DISPLAYED));

	SCOPE_EXIT
	{
		Global->Opt->DeleteToRecycleBin=Opt_DeleteToRecycleBin;
		// Разрешить перерисовку окна
		WindowFromLaunched->Unlock();

		if (NeedUpdate)
		{
			ShellUpdatePanels(SrcPanel,NeedSetUpADir);
		}
	};

	if (!(SelCount=SrcPanel->GetSelCount()))
		return;

	// Удаление в корзину только для  FIXED-дисков
	{
		string strRoot;
		SrcPanel->GetSelName(nullptr,FileAttr);
		SrcPanel->GetSelName(&strSelName,FileAttr);
		ConvertNameToFull(strSelName, strRoot);
		GetPathRoot(strRoot,strRoot);

		if (Global->Opt->DeleteToRecycleBin && FAR_GetDriveType(strRoot) != DRIVE_FIXED)
			Global->Opt->DeleteToRecycleBin=0;
	}

	if (SelCount==1)
	{
		SrcPanel->GetSelName(nullptr,FileAttr);
		SrcPanel->GetSelName(&strSelName,FileAttr);

		if (TestParentFolderName(strSelName) || strSelName.empty())
		{
			NeedUpdate=FALSE;
			return;
		}

		strDeleteFilesMsg = strSelName;
		QuoteLeadingSpace(strDeleteFilesMsg);
	}
	else
	{
		// в зависимости от числа ставим нужное окончание
		const wchar_t *Ends;
		FormatString StrItems;
		StrItems << SelCount;
		Ends=MSG(MAskDeleteItemsA);
		size_t LenItems = StrItems.size();

		if (LenItems > 0)
		{
			if ((LenItems >= 2 && StrItems[LenItems-2] == L'1') ||
			        StrItems[LenItems-1] >= L'5' ||
			        StrItems[LenItems-1] == L'0')
				Ends=MSG(MAskDeleteItemsS);
			else if (StrItems[LenItems-1] == L'1')
				Ends=MSG(MAskDeleteItems0);
		}
		strDeleteFilesMsg = LangString(MAskDeleteItems) << SelCount << Ends;
	}

	Ret=1;

	//   Обработка "удаления" линков
	if ((FileAttr & FILE_ATTRIBUTE_REPARSE_POINT) && SelCount==1)
	{
		string strJuncName;
		ConvertNameToFull(strSelName,strJuncName);

		if (GetReparsePointInfo(strJuncName, strJuncName)) // ? SelName ?
//.........这里部分代码省略.........
开发者ID:chapgaga,项目名称:farmanager,代码行数:101,代码来源:delete.cpp

示例11: Unlock

PThreadMutex::Locker::~Locker()
{
    Unlock();
}
开发者ID:32bitmicro,项目名称:riscv-lldb,代码行数:4,代码来源:PThreadMutex.cpp

示例12: time

void LogUnixServer::Log(const LogType Type, const std::string &str) {
	char *msg = NULL;

	time_t current = time(NULL);
	struct tm timeinfo;
	char buf[128];

	localtime_r(&current, &timeinfo);
	strftime(buf, sizeof(buf), "%F %T", &timeinfo);

	if (asprintf(&msg, "%s - %s [PID: %d] - %s\n", buf, LogTypeToStr(Type).c_str(), getpid(), str.c_str()) < 0)
	{
		std::stringstream ss;
		ss << "asprintf failed error:" << strerror(errno);
		throw(LogException(ss.str()));
	}
	else
	{
		std::list<int> broken;
		int len = strlen(msg);

		Lock();

		for(auto fd : m_list)
		{
			ssize_t offset = 0;
			ssize_t ret = 0;
			do
			{
				ret = write(fd, msg + offset, len - offset);
				if (ret < 0)
				{
					switch(errno)
					{
						case EINTR:
							ret = 0; //Fudge this as if we didn't write anything
							break;
						default:
							break;
					}
				}
				else
				{
					offset += len;
				}
			} while(offset < len);

			if (ret < len || ret == 0)
			{
				broken.push_back(fd);
			}
		}

		//Kick any broken clients
		for(auto fd : broken)
		{
			if (close(fd) < 0)
			{
				abort();
			}
			m_list.remove(fd);
		}

		Unlock();

	}
	free(msg);
}
开发者ID:mistralol,项目名称:liblogger,代码行数:68,代码来源:LogUnixServer.cpp

示例13: Lock


//.........这里部分代码省略.........
				// the bool
				v[2] = VARIANT_TRUE; // the bool
				V_VT(&v[2]) = VT_BOOL;
				// the first param.
				v[3] = nID;
				DISPPARAMS params = { v, NULL, 4, 0 };
				hr = pEvent->Invoke(dispid, IID_NULL, 0, DISPATCH_METHOD, &params, NULL, NULL, NULL);
				// all known impls return these values in the out pointer.
				_ASSERTE(out_result1==nID+3);
				_ASSERTE(out_result2==nID+4);
			}
			// Now with various combinations of named args.  Like Python, this 
			// assumes that param DISPIDs start with zero, are sequential and
			// in the same order as the IDL signature.
			if (SUCCEEDED(hr)) {
				// Call again - this time with named params.
				LONG out_result1 = nID+1;
				LONG out_result2 = nID+2;
				CComVariant v[4];

				// the "out2" outVal;
				V_VT(&v[3]) = VT_I4 | VT_BYREF;
				v[3].plVal = &out_result2;
				// the "out1" outVal;
				V_VT(&v[2]) = VT_I4 | VT_BYREF;
				v[2].plVal = &out_result1;
				// the bool
				v[1] = VARIANT_TRUE; // the bool
				V_VT(&v[1]) = VT_BOOL;
				// the first param.
				v[0] = nID;
				// Build 210 and earlier, this was the only way params *could* be passed,
				// which happily was the same way MSOffice did it.
				DISPID namedIDs[4] = {0, 1, 2, 3};
				DISPPARAMS params = { v, namedIDs, 4, 4 };
				hr = pEvent->Invoke(dispid, IID_NULL, 0, DISPATCH_METHOD, &params, NULL, NULL, NULL);
				// all known impls return nID+1 in the out pointer.
				_ASSERTE(out_result1==nID+3);
				_ASSERTE(out_result2==nID+4);
			}
			// Try some other funky combinations to mess with Python :)
			if (SUCCEEDED(hr)) {
				// First 2 positional, 2nd 2 by name.
				LONG out_result1 = nID+1;
				LONG out_result2 = nID+2;

				CComVariant v[4];
				// the first param.
				v[3] = nID;
				// 2nd positional
				v[2] = VARIANT_TRUE; // the bool
				V_VT(&v[2]) = VT_BOOL;
				// named ones up front.

				// the "out2" outVal (dispid=3)
				V_VT(&v[1]) = VT_I4 | VT_BYREF;
				v[1].plVal = &out_result2;
				// the "out1" outVal (dispid=2)
				V_VT(&v[0]) = VT_I4 | VT_BYREF;
				v[0].plVal = &out_result1;

				DISPID namedIDs[2] = {2, 3};
				DISPPARAMS params = { v, namedIDs, 4, 2 };
				hr = pEvent->Invoke(dispid, IID_NULL, 0, DISPATCH_METHOD, &params, NULL, NULL, NULL);
				// all known impls return nID+1 in the out pointer.
				_ASSERTE(out_result1==nID+3);
				_ASSERTE(out_result2==nID+4);
			}

			if (SUCCEEDED(hr)) {
				// Only pass the 2 out params - Python must ensure earlier
				// ones are also passed.
				LONG out_result1 = nID+1;
				LONG out_result2 = nID+2;

				CComVariant v[4];
				// the "out2" outVal (dispid=3)
				V_VT(&v[0]) = VT_I4 | VT_BYREF;
				v[0].plVal = &out_result2;
				// the "out1" outVal (dispid=2)
				V_VT(&v[1]) = VT_I4 | VT_BYREF;
				v[1].plVal = &out_result1;

				DISPID namedIDs[2] = {3, 2};
				DISPPARAMS params = { v, namedIDs, 2, 2 };

				hr = pEvent->Invoke(dispid, IID_NULL, 0, DISPATCH_METHOD, &params, NULL, NULL, NULL);
				// all known impls return nID+1 in the out pointer.
				_ASSERTE(out_result1==nID+3);
				_ASSERTE(out_result2==nID+4);
			}
//			IPyCOMTestEvent* pIEvent = (IPyCOMTestEvent*)*pp;
//			hr = pIEvent->Fire(nID);
		}
		pp++;
	}
	Unlock();
	_ASSERTE(SUCCEEDED(hr));
	return hr;
}
开发者ID:Dechy,项目名称:pywin32,代码行数:101,代码来源:PyCOMImpl.cpp

示例14: __KTRACE_OPT

TInt DPowerManager::PowerDown()
	{ // called by ExecHandler 
	__KTRACE_OPT(KPOWER,Kern::Printf(">PowerManger::PowerDown(0x%x) Enter", iPowerController->iTargetState));
	__ASSERT_CRITICAL;

	Lock();


	if (iPowerController->iTargetState == EPwActive)
		{
		Unlock();
		return KErrNotReady;
		}

    __PM_ASSERT(iHandlers);
	NFastSemaphore shutdownSem(0);
	NTimer ntimer;
	TDfc dfc(ShutDownTimeoutFn, &shutdownSem);
#ifndef _DEBUG_POWER	
	iPendingShutdownCount = 0;
#endif	
	DPowerHandler* ph = iHandlers;
	//Power down in reverse order of handle registration.
	do
		{
#ifdef _DEBUG_POWER
		__PM_ASSERT(!(ph->iStatus & DPowerHandler::EDone));
#endif
		ph->iSem = &shutdownSem; 
		ph->PowerDown(iPowerController->iTargetState);
#ifndef _DEBUG_POWER		
		iPendingShutdownCount++; 
#else
		if(iPslShutdownTimeoutMs>0)
			{
		    // Fire shut down timeout timer			
			ntimer.OneShot(iPslShutdownTimeoutMs, dfc);
			}

		NKern::FSWait(&shutdownSem);	// power down drivers one after another to simplify debug
		__e32_atomic_and_ord32(&(ph->iStatus), ~DPowerHandler::EDone);

		// timeout condition
		if(iPslShutdownTimeoutMs>0 && ph->iSem)
			{
			__e32_atomic_store_ord_ptr(&ph->iSem, 0);
			}
		ntimer.Cancel();
#endif		
		ph = ph->iPrev;
		}while(ph != iHandlers);

#ifndef _DEBUG_POWER
	if(iPslShutdownTimeoutMs>0)
		{
		// Fire shut down timeout timer
		ntimer.OneShot(iPslShutdownTimeoutMs, dfc);
		}

	ph = iHandlers;
	do
		{
		NKern::FSWait(&shutdownSem);
		if(__e32_atomic_load_acq32(&iPendingShutdownCount)==ESHUTDOWN_TIMEOUT)
			{
			iPendingShutdownCount = 0;
			NKern::Lock();
			shutdownSem.Reset(); // iPendingShutdownCount could be altered while ShutDownTimeoutFn is running
		       			     // reset it to make sure shutdownSem is completely clean.	
			NKern::Unlock();
			break;
			}
		__e32_atomic_add_ord32(&iPendingShutdownCount, (TUint)(~0x0)); // iPendingShutDownCount--;
		ph = ph->iPrev;
		}while(ph != iHandlers);

	ntimer.Cancel();
	
#endif

	TTickQ::Wait();

	iPowerController->PowerDown(K::SecondQ->WakeupTime());
	__PM_ASSERT(iPowerController->iTargetState != EPwOff);
	iPowerController->iTargetState = EPwActive;

	K::SecondQ->WakeUp();
	TTickQ::Signal();

	NFastSemaphore powerupSem(0);

	ph = iHandlers->iNext;
	//Power up in same order of handle registration.
	do
		{
#ifdef _DEBUG_POWER
		__PM_ASSERT(!(ph->iStatus & DPowerHandler::EDone));
#endif
		ph->iSem = &powerupSem;
		ph->PowerUp();
//.........这里部分代码省略.........
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:101,代码来源:power.cpp

示例15: Unlock

gmCodeTree::~gmCodeTree()
{
  Unlock();
}
开发者ID:eddietree,项目名称:tiger,代码行数:4,代码来源:gmCodeTree.cpp


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