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


C++ UnLock函数代码示例

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


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

示例1: isAmigaDirectory

static boolean isAmigaDirectory (const char *const name)
{
	boolean result = FALSE;
	struct FileInfoBlock *const fib = xMalloc (1, struct FileInfoBlock);
	if (fib != NULL)
	{
		const BPTR flock = Lock ((UBYTE *) name, (long) ACCESS_READ);

		if (flock != (BPTR) NULL)
		{
			if (Examine (flock, fib))
				result = ((fib->fib_DirEntryType >= 0) ? TRUE : FALSE);
			UnLock (flock);
		}
		eFree (fib);
	}
	return result;
}
开发者ID:Twinside,项目名称:CTagSpotlight,代码行数:18,代码来源:routines.c

示例2: Lock

void OMXPlayerAudio::Flush()
{
  Lock();
  LockDecoder();
  m_flush = true;
  while (!m_packets.empty())
  {
    OMXPacket *pkt = m_packets.front(); 
    m_packets.pop_front();
    OMXReader::FreePacket(pkt);
  }
  m_iCurrentPts = DVD_NOPTS_VALUE;
  m_cached_size = 0;
  if(m_decoder)
    m_decoder->Flush();
  UnLockDecoder();
  UnLock();
}
开发者ID:BenRomberg,项目名称:omxplayer,代码行数:18,代码来源:OMXPlayerAudio.cpp

示例3: Lock

BOOL TInifile::WriteIni()
{
	Lock();

	BOOL	ret = FALSE;
	HANDLE	hFile = ::CreateFileW(iniFile, GENERIC_WRITE, 0, 0, CREATE_ALWAYS,
									FILE_ATTRIBUTE_NORMAL, 0);

	if (hFile != INVALID_HANDLE_VALUE) {
#define MIN_INI_ALLOC (64 * 1024)
#define MAX_INI_ALLOC (10 * 1024 * 1024)
#define MIN_LINE_SIZE (2 * 1024)
		VBuf	vbuf(MIN_INI_ALLOC, MAX_INI_ALLOC);
		char	*p = (char *)vbuf.Buf();

		for (TIniSection *sec = TopObj(); sec && p; sec = NextObj(sec)) {
			TIniKey *key = sec->TopObj();
			int		len = 0;
			if (key) {
				if (sec->Name()) {
					len = sprintf(p, "[%s]\r\n", sec->Name());
					p = NextBuf(&vbuf, len, MIN_LINE_SIZE, MIN_INI_ALLOC);
				}
				while (key) {
					if (key->Key())	{
						len = sprintf(p, "%s=\"%s\"\r\n", key->Key(), key->Val());
						p = NextBuf(&vbuf, len, MIN_LINE_SIZE, MIN_INI_ALLOC);
					}
					else {
						len = sprintf(p, "%s\r\n", key->Val());
						p = NextBuf(&vbuf, len, MIN_LINE_SIZE, MIN_INI_ALLOC);
					}
					key = sec->NextObj(key);
				}
			}
		}
		DWORD	size;
		ret = ::WriteFile(hFile, vbuf.Buf(), (DWORD)vbuf.UsedSize(), &size, 0);
		::CloseHandle(hFile);
	}
	UnLock();

	return	ret;
}
开发者ID:darkphase,项目名称:FastCopy,代码行数:44,代码来源:tini.cpp

示例4: GetDiskInfo

// Get disk info
LONG GetDiskInfo(char *device,struct InfoData *info)
{
	struct DevProc *proc;
	struct DosList *dos;
	LONG res=0;

	// Get device proc
	if (!(proc=GetDeviceProc(device,0)))
		return 0;

	// Send packet
#ifdef __AROS__
	if (((struct Library *)DOSBase)->lib_Version<50)
	{
		//res=Info(proc->dvp_Lock,info);
		BPTR lock;
		if ((lock=Lock(device,SHARED_LOCK)))
		{
			res=Info(lock,info);
			UnLock(lock);
		}
	}
	else
#endif
	res=DoPkt(proc->dvp_Port,ACTION_DISK_INFO,MKBADDR(info),0,0,0,0);

	// Clear "in use" flag to indicate formatting by default
	info->id_InUse=0;

	// Get doslist pointer
	if ((dos=DeviceFromHandler(proc->dvp_Port,NULL)))
	{
		// Invalid device?
		if (!GetDeviceUnit(dos->dol_misc.dol_handler.dol_Startup,NULL,NULL))
		{
			// Disk can't be formatted
			info->id_InUse=1;
		}
	}

	// Free device proc
	FreeDeviceProc(proc);
	return res;
}
开发者ID:timofonic,项目名称:dopus5allamigas,代码行数:45,代码来源:misc.c

示例5: delete_temp_files

// Delete any temporary files
void delete_temp_files(struct DateStamp *last)
{
	struct AnchorPath *anchor;
	BPTR old,lock;

	// Lock T: and cd
	if ((lock=Lock("t:",ACCESS_READ)))
	{
		// CD to t:
		old=CurrentDir(lock);

		// Allocate an anchor
		if ((anchor=AllocVec(sizeof(struct AnchorPath),MEMF_CLEAR)))
		{
			short error;
			struct FileInfoBlock fibcopy;

			// See if any script files already exist
			error=MatchFirst("T:dopus#?tmp#?",anchor);
			while (!error)
			{
				// Copy fib
				fibcopy=anchor->ap_Info;

				// Get next
				error=MatchNext(anchor);

				// Check datestamp
				if (!last ||
					CompareDates(&fibcopy.fib_Date,last)>=0)
				{
					// Try to delete file
					DeleteFile(fibcopy.fib_FileName);
				}
			}

			// Cleanup anchor
			MatchEnd(anchor);
			FreeVec(anchor);
		}

		UnLock(CurrentDir(old));
	}
}
开发者ID:timofonic,项目名称:dopus5allamigas,代码行数:45,代码来源:cleanup.c

示例6: Lock

TInt RSignalSession::OnDemandConnection()
	{
	TInt err = KErrNone;
	//On Demand connection
	if ( !iIsConnected )
		{
		Lock();
		if ( !iIsConnected )
			{
			err = Connect ();
			if ( KErrNone == err)
				{
				iIsConnected = ETrue;
				}
			}
		UnLock();
		}
	return err;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:19,代码来源:signalclient.cpp

示例7: UnLock

//自ストリームのサービス一覧を取得する
//戻り値:
// エラーコード
//引数:
// serviceList				[OUT]サービス情報のリスト
DWORD CBonCtrl::GetServiceListActual(
	vector<TS_SERVICE_INFO>* serviceList
	)
{
	if( Lock(L"GetServiceListActual") == FALSE ) return EpgNoData;

	DWORD _serviceListSize = 0;
	SERVICE_INFO* _serviceList = NULL;
	DWORD err = this->tsOut.GetServiceListActual(&_serviceListSize, &_serviceList);
	if( err == NO_ERR ){
		for( DWORD i=0; i<_serviceListSize; i++ ){
			TS_SERVICE_INFO item;
			item.ONID = _serviceList[i].original_network_id;
			item.TSID = _serviceList[i].transport_stream_id;
			item.SID = _serviceList[i].service_id;
			if( _serviceList[i].extInfo != NULL ){
				item.serviceType = _serviceList[i].extInfo->service_type;
				item.partialFlag = _serviceList[i].extInfo->partialReceptionFlag;
				if( _serviceList[i].extInfo->service_name != NULL ){
					item.serviceName = _serviceList[i].extInfo->service_name;
				}else{
					item.serviceName = L"";
				}
				if( _serviceList[i].extInfo->network_name != NULL ){
					item.networkName = _serviceList[i].extInfo->network_name;
				}else{
					item.networkName = L"";
				}
				item.remoteControlKeyID = _serviceList[i].extInfo->remote_control_key_id;
			}else{
				item.serviceType = 0;
				item.partialFlag = 0;
				item.serviceName = L"";
				item.networkName = L"";
				item.remoteControlKeyID = 0;
			}
			serviceList->push_back(item);
		}
	}

	UnLock();
	return err;
}
开发者ID:Velmy,项目名称:EDCB,代码行数:48,代码来源:BonCtrl.cpp

示例8: Lock

void COMXCoreComponent::FlushInput()
{
    if(!m_handle)
        return;

    Lock();

    OMX_ERRORTYPE omx_err = OMX_ErrorNone;

    omx_err = OMX_SendCommand(m_handle, OMX_CommandFlush, m_input_port, NULL);

    if(omx_err != OMX_ErrorNone) {
        Logger::LogOut(LOG_LEVEL_ERROR, "COMXCoreComponent::FlushInput - Error on component %s omx_err(0x%08x)",
                m_componentName.c_str(), (int)omx_err);
    }
    WaitForCommand(OMX_CommandFlush, m_input_port);

    UnLock();
}
开发者ID:dlxqlig,项目名称:xmbc_audio_engine,代码行数:19,代码来源:OMXCore.cpp

示例9: Lock

bool OMXClock::OMXResume(bool lock /* = true */)
{
  if(m_omx_clock.GetComponent() == NULL)
    return false;

  if(m_pause)
  {
    if(lock)
      Lock();

    if (OMXSetSpeed(m_omx_speed, false, true))
      m_pause = false;

    m_last_media_time = 0.0f;
    if(lock)
      UnLock();
  }
  return m_pause == false;
}
开发者ID:68foxboris,项目名称:xbmc,代码行数:19,代码来源:OMXClock.cpp

示例10: ClearEpgData

BOOL CEpgDBManager::ReloadEpgData()
{
	if( Lock() == FALSE ) return FALSE;

	BOOL ret = TRUE;
	if( this->loadThread == NULL ){
		//受信スレッド起動
		ClearEpgData();
		ResetEvent(this->loadStopEvent);
		this->loadThread = (HANDLE)_beginthreadex(NULL, 0, LoadThread, (LPVOID)this, CREATE_SUSPENDED, NULL);
		SetThreadPriority( this->loadThread, THREAD_PRIORITY_NORMAL );
		ResumeThread(this->loadThread);
	}else{
		ret = FALSE;
	}

	UnLock();
	return ret;
}
开发者ID:HK323232,项目名称:EDCB,代码行数:19,代码来源:EpgDBManager.cpp

示例11: GetVIPCID

inline s32 Factory::AddVIPC(VIPCDeviceParam & pParam)
{
    s32 nId = GetVIPCID();
    FactoryDeviceChangeData change;

    VDC_DEBUG( "%s GetDeviceID %d\n",__FUNCTION__, nId);

    Lock();
    pParam.m_Conf.data.conf.nId = nId;
    m_VIPCDeviceParamMap[nId] = pParam;

    m_Conf.AddVIPC(pParam.m_Conf, nId);
    UnLock();
    change.id = nId;
    change.type = FACTORY_VIPC_ADD;
    CallDeviceChange(change);
	
    return nId;
}
开发者ID:FatCat1411,项目名称:opencvr,代码行数:19,代码来源:factoryimpl.hpp

示例12: Sys_SetBinaryPath

/*
=================
Sys_SetBinaryPath
=================
*/
void Sys_SetBinaryPath(const char *path)
{
#ifdef __AROS__
	if (!strcmp(path, "."))
	{
		BPTR lock = Lock("PROGDIR:", ACCESS_READ);

		if (lock)
		{
			NameFromLock(lock, binaryPath, sizeof(binaryPath));
			UnLock(lock);
		}
	}
	else
#endif
	{
		Q_strncpyz(binaryPath, path, sizeof(binaryPath));
	}
}
开发者ID:BulldogDrummond,项目名称:etlegacy,代码行数:24,代码来源:sys_main.c

示例13: archdep_expand_path

/* return malloc'd version of full pathname of orig_name */
int archdep_expand_path(char **return_path, const char *orig_name)
{
    BPTR lock;

    lock = Lock(orig_name, ACCESS_READ);
    if (lock) {
        char name[1024];
        LONG rc;

        rc = NameFromLock(lock, name, 1024);
        UnLock(lock);
        if (rc) {
            *return_path = lib_stralloc(name);
            return 0;
        }
    }
    *return_path = lib_stralloc(orig_name);
    return 0;
}
开发者ID:r-type,项目名称:vice-libretro,代码行数:20,代码来源:archdep.c

示例14: ResetEvent

//タイムシフト送信を開始する
//戻り値:
// TRUE(成功)、FALSE(失敗)
BOOL CTimeShiftUtil::StartTimeShift()
{
	if( Lock() == FALSE ) return FALSE;
	BOOL ret = TRUE;
	if( this->filePath.size() == 0 ){
		ret = FALSE;
	}else{
		if( this->readThread == NULL ){
			//受信スレッド起動
			ResetEvent(this->readStopEvent);
			this->readThread = (HANDLE)_beginthreadex(NULL, 0, ReadThread, (LPVOID)this, CREATE_SUSPENDED, NULL);
			SetThreadPriority( this->readThread, THREAD_PRIORITY_NORMAL );
			ResumeThread(this->readThread);
		}
	}

	UnLock();
	return ret;
}
开发者ID:nekopanda,项目名称:EDCB,代码行数:22,代码来源:TimeShiftUtil.cpp

示例15: NewList

struct List *LoadBlankerEntries( STRPTR Path )
{
    struct FileInfoBlock *Blk;
    struct List *Entries = 0L;
    BlankerEntry *New;
    BPTR DirLock;
	
    if(!( Entries = AllocVec( sizeof( struct List ), MEMF_CLEAR )))
        return 0L;
    else
        NewList( Entries );
	
    NumBlankEntries = 0;
    
    if( DirLock = Lock( Path, ACCESS_READ ))
    {
        if(( Blk = AllocDosObject( DOS_FIB, 0L ))&&( Examine( DirLock, Blk )))
        {
            while( ExNext( DirLock, Blk ))
            {
                if(( Blk->fib_FileName )&&
                   ( FileIsModule( Path, Blk->fib_FileName )))
                {
                    if( New = NewBlankerEntry( Path, Blk->fib_FileName,
											  Blk->fib_Comment ))
                    {
                        New->be_Node.ln_Pri = 128 - ( New->be_Name[0] - 'a' );
                        Enqueue( Entries, ( struct Node * )New );
                        NumBlankEntries++;
                    }
                }
            }
            FreeDosObject( DOS_FIB, Blk );
        }
        UnLock( DirLock );
    }
    
    if( New = NewBlankerEntry( ":", "Random", "" ))
        AddTail( Entries, ( struct Node * )New );
	
    return Entries;
}
开发者ID:samskivert,项目名称:garshneblanker,代码行数:42,代码来源:module.c


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