int32 FServiceConnection::FindOrAddThread(const FStatNameAndInfo& Thread) { SCOPE_CYCLE_COUNTER(STAT_PC_FindOrAddThread); const FName LongName = Thread.GetRawName(); int32* const ThreadIDPtr = ThreadNameArray.Find( LongName ); int32 ThreadID = ThreadIDPtr != nullptr ? *ThreadIDPtr : -1; if (!ThreadIDPtr) { // meta data has been updated CurrentData.MetaDataUpdated = true; // get the thread description FString Desc; Thread.GetDescription(Desc); // Extract out the thread id and add to the descriptions FString ID = Desc.Replace(TEXT("Thread_"), TEXT("")); ID = ID.Replace(TEXT("_0"), TEXT("")); ThreadID = FParse::HexNumber(*ID); ThreadNameArray.Add(LongName, ThreadID); // add to the meta data FScopeLock ScopeLock(&CriticalSection); MetaData.ThreadDescriptions.Add(ThreadID, Thread.GetShortName().ToString()); } return ThreadID; }
/* FBuildPatchHTTP implementation *****************************************************************************/ bool FBuildPatchHTTP::Tick( float Delta ) { // Process the http request and cancel queues { FScopeLock ScopeLock( &HttpRequestQueueCS ); if( FBuildPatchInstallError::HasFatalError() ) { // Make sure all requests get canceled if we get fatal error TArray< int32 > RequestKeys; HttpRequestMap.GetKeys( RequestKeys ); CancelRequestQueue.Append( RequestKeys ); while( HttpRequestQueue.Num() > 0 ) { FHttpRequestInfo HttpRequestInfo = HttpRequestQueue.Pop(); HttpRequestInfo.OnCompleteDelegate.ExecuteIfBound( NULL, NULL, false ); } } else { while( HttpRequestQueue.Num() > 0 ) { FHttpRequestInfo HttpRequestInfo = HttpRequestQueue.Pop(); TSharedRef< IHttpRequest > HttpRequest = FHttpModule::Get().CreateRequest(); HttpRequest->OnProcessRequestComplete() = HttpRequestInfo.OnCompleteDelegate; HttpRequest->OnRequestProgress() = HttpRequestInfo.OnProgressDelegate; HttpRequest->SetURL( HttpRequestInfo.UrlRequest ); HttpRequest->ProcessRequest(); HttpRequestMap.Add( HttpRequestInfo.RequestID, HttpRequest ); } } while( CancelRequestQueue.Num() > 0 ) { const int32 CancelID = CancelRequestQueue.Pop(); TWeakPtr< IHttpRequest > HttpRequest = HttpRequestMap.FindRef( CancelID ); HttpRequestMap.Remove( CancelID ); TSharedPtr< IHttpRequest > HttpRequestPinned = HttpRequest.Pin(); if( HttpRequestPinned.IsValid() ) { HttpRequestPinned->CancelRequest(); } } } // Process the Analytics Event queue { FScopeLock ScopeLock( &AnalyticsEventQueueCS ); while( AnalyticsEventQueue.Num() > 0 ) { const FAnalyticsEventInfo& EventInfo = AnalyticsEventQueue[ AnalyticsEventQueue.Num() -1 ]; FBuildPatchAnalytics::RecordEvent( EventInfo.EventName, EventInfo.Attributes ); AnalyticsEventQueue.Pop(); } } return true; }
void VRPNButtonInputDevice::Update() { if(InputDevice){ { FScopeLock ScopeLock(&CritSect); InputDevice->mainloop(); } while(KeyPressStack.Num() > 0) { KeyEventPair ButtonEvent = KeyPressStack.Pop(/*bAllowShrinking=*/false); // process the button presses const FKey* Key = ButtonMap.Find(ButtonEvent.Button); if(Key == nullptr) { UE_LOG(LogVRPNInputDevice, Warning, TEXT("Could not find button with id %i."), ButtonEvent.Button); return; } if(ButtonEvent.State == 1) { FKeyEvent KeyEvent(*Key, FSlateApplication::Get().GetModifierKeys(), 0, 0, 0, 0); FSlateApplication::Get().ProcessKeyDownEvent(KeyEvent); } else { FKeyEvent KeyEvent(*Key, FSlateApplication::Get().GetModifierKeys(), 0, 0, 0, 0); FSlateApplication::Get().ProcessKeyUpEvent(KeyEvent); } } } }
/** * Resize the GL context. */ void PlatformResizeGLContext( FPlatformOpenGLDevice* Device, FPlatformOpenGLContext* Context, uint32 SizeX, uint32 SizeY, bool bFullscreen, bool bWasFullscreen, GLenum BackBufferTarget, GLuint BackBufferResource) { FScopeLock ScopeLock(Device->ContextUsageGuard); { uint32 WindowStyle = WS_CAPTION | WS_SYSMENU; uint32 WindowStyleEx = 0; HWND InsertAfter = HWND_NOTOPMOST; if (bFullscreen) { // Get the monitor info from the window handle. HMONITOR hMonitor = MonitorFromWindow(Context->WindowHandle, MONITOR_DEFAULTTOPRIMARY); MONITORINFOEX MonitorInfo; memset(&MonitorInfo, 0, sizeof(MONITORINFOEX)); MonitorInfo.cbSize = sizeof(MONITORINFOEX); GetMonitorInfo(hMonitor, &MonitorInfo); DEVMODE Mode; Mode.dmSize = sizeof(DEVMODE); Mode.dmBitsPerPel = 32; Mode.dmPelsWidth = SizeX; Mode.dmPelsHeight = SizeY; Mode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; // Turn on fullscreen mode for the current monitor ChangeDisplaySettingsEx(MonitorInfo.szDevice, &Mode, NULL, CDS_FULLSCREEN, NULL); WindowStyle = WS_POPUP; WindowStyleEx = WS_EX_APPWINDOW | WS_EX_TOPMOST; InsertAfter = HWND_TOPMOST; } else if (bWasFullscreen) { ChangeDisplaySettings(NULL, 0); } //SetWindowLong(Context->WindowHandle, GWL_STYLE, WindowStyle); //SetWindowLong(Context->WindowHandle, GWL_EXSTYLE, WindowStyleEx); { FScopeContext ScopeContext(Context); if (Context->ViewportFramebuffer == 0) { glGenFramebuffers(1, &Context->ViewportFramebuffer); } glBindFramebuffer(GL_FRAMEBUFFER, Context->ViewportFramebuffer); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, BackBufferTarget, BackBufferResource, 0); #if UE_BUILD_DEBUG glReadBuffer(GL_COLOR_ATTACHMENT0); glDrawBuffer(GL_COLOR_ATTACHMENT0); #endif FOpenGL::CheckFrameBuffer(); glViewport(0, 0, SizeX, SizeY); static GLfloat ZeroColor[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; glClearBufferfv(GL_COLOR, 0, ZeroColor ); } } }
void FHttpManager::Flush(bool bShutdown) { FScopeLock ScopeLock(&RequestLock); if (bShutdown) { if (Requests.Num()) { UE_LOG(LogHttp, Display, TEXT("Http module shutting down, but needs to wait on %d outstanding Http requests:"), Requests.Num()); } // Clear delegates since they may point to deleted instances for (TArray<TSharedRef<IHttpRequest>>::TIterator It(Requests); It; ++It) { TSharedRef<IHttpRequest> Request = *It; Request->OnProcessRequestComplete().Unbind(); Request->OnRequestProgress().Unbind(); UE_LOG(LogHttp, Display, TEXT(" verb=[%s] url=[%s] status=%s"), *Request->GetVerb(), *Request->GetURL(), EHttpRequestStatus::ToString(Request->GetStatus())); } } // block until all active requests have completed double LastTime = FPlatformTime::Seconds(); while (Requests.Num() > 0) { const double AppTime = FPlatformTime::Seconds(); Tick(AppTime - LastTime); LastTime = AppTime; if (Requests.Num() > 0) { UE_LOG(LogHttp, Display, TEXT("Sleeping 0.5s to wait for %d outstanding Http requests."), Requests.Num()); FPlatformProcess::Sleep(0.5f); } } }
/** * Sets the text displayed on the splash screen (for startup/loading progress) * * @param InType Type of text to change * @param InText Text to display */ void FWindowsPlatformSplash::SetSplashText( const SplashTextType::Type InType, const TCHAR* InText ) { // We only want to bother drawing startup progress in the editor, since this information is // not interesting to an end-user (also, it's not usually localized properly.) if( GSplashScreenThread ) { // Only allow copyright text displayed while loading the game. Editor displays all. if( InType == SplashTextType::CopyrightInfo || GIsEditor ) { bool bWasUpdated = false; { // Take a critical section since the splash thread may already be repainting using this text FScopeLock ScopeLock( &GSplashScreenSynchronizationObject ); // Update splash text if( FCString::Strcmp( InText, *GSplashScreenText[ InType ].ToString() ) != 0 ) { GSplashScreenText[ InType ] = FText::FromString( InText ); bWasUpdated = true; } } if( bWasUpdated ) { // Repaint the window const BOOL bErase = false; InvalidateRect( GSplashScreenWnd, &GSplashScreenTextRects[ InType ], bErase ); } } } }
FVorbisAudioInfo::~FVorbisAudioInfo( void ) { FScopeLock ScopeLock(&VorbisCriticalSection); check(VFWrapper != nullptr); delete VFWrapper; VFWrapper = nullptr; }
void FVorbisAudioInfo::SeekToTime( const float SeekTime ) { FScopeLock ScopeLock(&VorbisCriticalSection); const float TargetTime = FMath::Min(SeekTime, ( float )ov_time_total( &VFWrapper->vf, -1 )); ov_time_seek( &VFWrapper->vf, TargetTime ); }
bool FNetworkPlatformFile::IsInLocalDirectory(const FString& Filename) { if (!bHasLoadedDDCDirectories) { // need to be careful here to avoid initializing the DDC from the wrong thread or using LocalDirectories while it is being initialized FScopeLock ScopeLock(&LocalDirectoriesCriticalSection); if (IsInGameThread() && GConfig && GConfig->IsReadyForUse()) { // one time DDC directory initialization // add any DDC directories to our list of local directories (local = inner platform file, it may // actually live on a server, but it will use the platform's file system) if (GetDerivedDataCache()) { TArray<FString> DdcDirectories; GetDerivedDataCacheRef().GetDirectories(DdcDirectories); LocalDirectories.Append(DdcDirectories); } FPlatformMisc::MemoryBarrier(); bHasLoadedDDCDirectories = true; } return IsInLocalDirectoryUnGuarded(Filename); } // once the DDC is initialized, we don't need to lock a critical section anymore return IsInLocalDirectoryUnGuarded(Filename); }
STDMETHODIMP FWmfMediaByteStream::GetLength( QWORD* pqwLength ) { FScopeLock ScopeLock(&CriticalSection); *pqwLength = (QWORD)Buffer->Num(); return S_OK; }
STDMETHODIMP FWmfMediaByteStream::Seek(MFBYTESTREAM_SEEK_ORIGIN SeekOrigin, LONGLONG qwSeekOffset, DWORD dwSeekFlags, QWORD* pqwCurrentPosition) { FScopeLock ScopeLock(&CriticalSection); if (AsyncReadInProgress) { return S_FALSE; } if (SeekOrigin == msoCurrent) { Archive->Seek(Archive->Tell() + qwSeekOffset); } else { Archive->Seek(qwSeekOffset); } if (pqwCurrentPosition != NULL) { *pqwCurrentPosition = (QWORD)Archive->Tell(); } return S_OK; }
STDMETHODIMP FWmfMediaByteStream::GetLength(QWORD* pqwLength) { FScopeLock ScopeLock(&CriticalSection); *pqwLength = (QWORD)Archive->TotalSize(); return S_OK; }
STDMETHODIMP FWmfMediaByteStream::Read(BYTE* pb, ULONG cb, ULONG* pcbRead) { FScopeLock ScopeLock(&CriticalSection); int64 Position = Archive->Tell(); int64 Size = Archive->TotalSize(); ULONG BytesToRead = cb; if (BytesToRead > (ULONG)Size) { BytesToRead = Size; } if ((Size - BytesToRead) < Archive->Tell()) { BytesToRead = Size - Position; } if (BytesToRead > 0) { Archive->Serialize(pb, BytesToRead); } if (pcbRead != NULL) { *pcbRead = BytesToRead; } Archive->Seek(Position + BytesToRead); return S_OK; }
STDMETHODIMP FWmfMediaByteStream::GetCapabilities(DWORD* pdwCapabilities) { FScopeLock ScopeLock(&CriticalSection); *pdwCapabilities = MFBYTESTREAM_IS_READABLE | MFBYTESTREAM_IS_SEEKABLE; return S_OK; }
STDMETHODIMP FWmfMediaByteStream::GetCurrentPosition(QWORD* pqwPosition) { FScopeLock ScopeLock(&CriticalSection); *pqwPosition = Archive->Tell(); return S_OK; }
const FText& FBuildPatchInstallError::GetErrorText() { static const FText NoError( LOCTEXT( "BuildPatchInstallError_NoError", "The operation was successful." ) ); static const FText DownloadError( LOCTEXT( "BuildPatchInstallError_DownloadError", "Could not download patch data. Please try again later." ) ); static const FText FileConstructionFail( LOCTEXT( "BuildPatchInstallError_FileConstructionFail", "A file corruption has occurred. Please try again." ) ); static const FText MoveFileToInstall( LOCTEXT( "BuildPatchInstallError_MoveFileToInstall", "A file access error has occurred. Please check your running processes." ) ); static const FText BuildVerifyFail( LOCTEXT( "BuildPatchInstallError_BuildCorrupt", "The installation is corrupt." ) ); static const FText ApplicationClosing( LOCTEXT( "BuildPatchInstallError_ApplicationClosing", "The application is closing." ) ); static const FText ApplicationError( LOCTEXT( "BuildPatchInstallError_ApplicationError", "Patching service could not start." ) ); static const FText UserCanceled( LOCTEXT( "BuildPatchInstallError_UserCanceled", "User cancelled." ) ); static const FText PrerequisiteError( LOCTEXT( "BuildPatchInstallError_PrerequisiteError", "Prerequisites install failed.") ); static const FText InvalidOrMax( LOCTEXT( "BuildPatchInstallError_InvalidOrMax", "An unknown error ocurred." ) ); FScopeLock ScopeLock( &ThreadLock ); switch( ErrorState ) { case EBuildPatchInstallError::NoError: return NoError; case EBuildPatchInstallError::DownloadError: return DownloadError; case EBuildPatchInstallError::FileConstructionFail: return FileConstructionFail; case EBuildPatchInstallError::MoveFileToInstall: return MoveFileToInstall; case EBuildPatchInstallError::BuildVerifyFail: return BuildVerifyFail; case EBuildPatchInstallError::ApplicationClosing: return ApplicationClosing; case EBuildPatchInstallError::ApplicationError: return ApplicationError; case EBuildPatchInstallError::UserCanceled: return UserCanceled; case EBuildPatchInstallError::PrerequisiteError: return PrerequisiteError; default: return InvalidOrMax; } }
bool FProfilerClientManager::AsyncLoad() { #if STATS while (LoadConnection->DataFrames.Num() > 0) { // Fire a meta data update message if (LoadConnection->DataFrames[0].MetaDataUpdated) { ProfilerMetaDataUpdatedDelegate.Broadcast(LoadConnection->InstanceId); ProfilerLoadedMetaDataDelegate.Broadcast(LoadConnection->InstanceId); } FScopeLock ScopeLock(&(LoadConnection->CriticalSection)); FProfilerDataFrame& DataFrame = LoadConnection->DataFrames[0]; ProfilerDataDelegate.Broadcast(LoadConnection->InstanceId, DataFrame, LoadConnection->DataLoadingProgress); LoadConnection->DataFrames.RemoveAt(0); } if (LoadTask->IsDone()) { ProfilerLoadCompletedDelegate.Broadcast(LoadConnection->InstanceId); LoadConnection = nullptr; delete LoadTask; LoadTask = nullptr; RetryTime = 5.f; return false; } #endif return true; }
bool FStreamingNetworkPlatformFile::MoveFile(const TCHAR* To, const TCHAR* From) { FScopeLock ScopeLock(&SynchronizationObject); FString RelativeFrom = From; MakeStandardNetworkFilename(RelativeFrom); FString RelativeTo = To; MakeStandardNetworkFilename(RelativeTo); FStreamingNetworkFileArchive Payload(NFS_Messages::MoveFile); Payload << RelativeFrom; Payload << RelativeTo; FArrayReader Response; if (SendPayloadAndReceiveResponse(Payload, Response) == false) { return false; } uint32 Success = 0; Response << Success; return !!Success; }
bool FStreamingNetworkPlatformFile::SendReadMessage(uint64 HandleId, uint8* Destination, int64 BytesToRead) { FScopeLock ScopeLock(&SynchronizationObject); // Send the filename over. FStreamingNetworkFileArchive Payload(NFS_Messages::Read); Payload << HandleId; Payload << BytesToRead; // Send the filename over FArrayReader Response; if (SendPayloadAndReceiveResponse(Payload, Response) == false) { return false; } // Get the server number of bytes read. int64 ServerBytesRead = 0; Response << ServerBytesRead; bool bSuccess = (ServerBytesRead == BytesToRead); if (bSuccess) { // Get the data. Response.Serialize(Destination, BytesToRead); } return bSuccess; }
/** * Decompress an entire ogg vorbis data file to a TArray */ void FVorbisAudioInfo::ExpandFile( uint8* DstBuffer, FSoundQualityInfo* QualityInfo ) { uint32 TotalBytesRead, BytesToRead; check( VFWrapper != NULL ); check( DstBuffer ); check( QualityInfo ); FScopeLock ScopeLock(&VorbisCriticalSection); // A zero buffer size means decompress the entire ogg vorbis stream to PCM. TotalBytesRead = 0; BytesToRead = QualityInfo->SampleDataSize; char* Destination = ( char* )DstBuffer; while( TotalBytesRead < BytesToRead ) { long BytesRead = ov_read( &VFWrapper->vf, Destination, BytesToRead - TotalBytesRead, 0, 2, 1, NULL ); if (BytesRead < 0) { // indicates an error - fill remainder of buffer with zero FMemory::Memzero(Destination, BytesToRead - TotalBytesRead); return; } TotalBytesRead += BytesRead; Destination += BytesRead; } }
STDMETHODIMP FWmfMediaByteStream::Read( BYTE* pb, ULONG cb, ULONG* pcbRead ) { FScopeLock ScopeLock(&CriticalSection); ULONG BytesToRead = cb; if (BytesToRead > (ULONG)Buffer->Num()) { BytesToRead = Buffer->Num(); } if ((Buffer->Num() - BytesToRead) < Position) { BytesToRead = Buffer->Num() - Position; } if (BytesToRead > 0) { FMemory::Memcpy(pb, ((BYTE*)Buffer->GetData() + Position), BytesToRead); } if (pcbRead != NULL) { *pcbRead = BytesToRead; } Position += BytesToRead; return S_OK; }
virtual IDerivedDataRollup* StartRollup() override { FScopeLock ScopeLock(&SynchronizationObject); FDerivedDataRollup* Result = new FDerivedDataRollup(); PendingRollups.Add(Result); return Result; }
uint32 FDDCCleanup::Run() { // Give up some time to the engine to start up and load everything Wait( 120.0f, 0.5f ); int32 FilesystemToCleanup = 0; // Check one directory every 5 seconds do { // Pick one random filesystem. TSharedPtr< FFilesystemInfo > FilesystemInfo; { FScopeLock ScopeLock( &DataLock ); if( CleanupList.Num() > 0 ) { FilesystemToCleanup %= CleanupList.Num(); FilesystemInfo = CleanupList[ FilesystemToCleanup++ ]; } } if( FilesystemInfo.IsValid() ) { CleanupFilesystemDirectory( FilesystemInfo ); } Wait( 5.0f ); } while( ShouldStop() == false ); return 0; }
virtual void SetHighPerformanceEnableForGroup(FName Group, bool Enable) override { FScopeLock ScopeLock(&SynchronizationObject); FThreadStats::MasterDisableChangeTagLockAdd(); FGroupEnable* Found = HighPerformanceEnable.Find(Group); if (Found) { Found->CurrentEnable = Enable; if (Enable) { for (auto It = Found->NamesInThisGroup.CreateIterator(); It; ++It) { EnableStat(It.Key(), It.Value()); } } else { for (auto It = Found->NamesInThisGroup.CreateIterator(); It; ++It) { DisableStat(It.Value()); } } } FThreadStats::MasterDisableChangeTagLockSubtract(); }
void FBuildPatchChunkCache::SkipChunkPart( const FChunkPartData& ChunkPart ) { check( bDownloadsStarted.GetValue() == 0 ); FScopeLock ScopeLock( &ChunkInfoLock ); const FGuid& ChunkGuid = ChunkPart.Guid; // The chunk we are skipping must be the first in FullChunkRefList list, otherwise we are calling out of order. check( FullChunkRefList.Num() > 0 && FullChunkRefList[ 0 ] == ChunkGuid ); // Must also be the chunk on top of ChunkUseOrderStack check( ChunkUseOrderStack.Num() > 0 && ChunkUseOrderStack.Last() == ChunkGuid ); // Remove this chunk from the full reference list FullChunkRefList.RemoveAt( 0 ); // If this was the last sequential reference to this chunk, also remove from order stack if( FullChunkRefList.Num() > 0 && FullChunkRefList[ 0 ] != ChunkUseOrderStack.Last() ) { ChunkUseOrderStack.Pop(); // The next chunk in both lists must be the same now check( FullChunkRefList[ 0 ] == ChunkUseOrderStack.Last() ); } // If this chunk is no longer referenced, remove from download list if( ChunkUseOrderStack.Contains( ChunkGuid ) == false ) { ChunksToDownload.Remove( ChunkGuid ); SkippedChunkDownloadSize += InstallManifet->GetDataSize( ChunkGuid ); } // Keep UI in check const float OriginalCount = TotalChunkDownloadSize; const float SkipCount = SkippedChunkDownloadSize; BuildProgress->SetStateProgress( EBuildPatchProgress::Downloading, SkipCount / OriginalCount ); }
int32 FAsyncIOSystemBase::CancelRequests( uint64* RequestIndices, int32 NumIndices ) { FScopeLock ScopeLock( CriticalSection ); // Iterate over all outstanding requests and cancel matching ones. int32 RequestsCanceled = 0; for( int32 OutstandingIndex=OutstandingRequests.Num()-1; OutstandingIndex>=0 && RequestsCanceled<NumIndices; OutstandingIndex-- ) { // Iterate over all indices of requests to cancel for( int32 TheRequestIndex=0; TheRequestIndex<NumIndices; TheRequestIndex++ ) { // Look for matching request index in queue. const FAsyncIORequest IORequest = OutstandingRequests[OutstandingIndex]; if( IORequest.RequestIndex == RequestIndices[TheRequestIndex] ) { INC_DWORD_STAT( STAT_AsyncIO_CanceledReadCount ); INC_DWORD_STAT_BY( STAT_AsyncIO_CanceledReadSize, IORequest.Size ); DEC_DWORD_STAT( STAT_AsyncIO_OutstandingReadCount ); DEC_DWORD_STAT_BY( STAT_AsyncIO_OutstandingReadSize, IORequest.Size ); // Decrement thread-safe counter to indicate that request has been "completed". IORequest.Counter->Decrement(); // IORequest variable no longer valid after removal. OutstandingRequests.RemoveAt( OutstandingIndex ); RequestsCanceled++; // Break out of loop as we've modified OutstandingRequests AND it no longer is valid. break; } } } return RequestsCanceled; }
const FString& FBuildPatchInstallError::ToString( const EBuildPatchInstallError::Type& ErrorType ) { // Const enum strings, special case no error. static const FString NoError( "SUCCESS" ); static const FString DownloadError( "EBuildPatchInstallError::DownloadError" ); static const FString FileConstructionFail( "EBuildPatchInstallError::FileConstructionFail" ); static const FString MoveFileToInstall( "EBuildPatchInstallError::MoveFileToInstall" ); static const FString BuildVerifyFail( "EBuildPatchInstallError::BuildVerifyFail" ); static const FString ApplicationClosing( "EBuildPatchInstallError::ApplicationClosing" ); static const FString ApplicationError( "EBuildPatchInstallError::ApplicationError" ); static const FString UserCanceled( "EBuildPatchInstallError::UserCanceled" ); static const FString PrerequisiteError( "EBuildPatchInstallError::PrerequisiteError" ); static const FString InvalidOrMax( "EBuildPatchInstallError::InvalidOrMax" ); FScopeLock ScopeLock( &ThreadLock ); switch( ErrorType ) { case EBuildPatchInstallError::NoError: return NoError; case EBuildPatchInstallError::DownloadError: return DownloadError; case EBuildPatchInstallError::FileConstructionFail: return FileConstructionFail; case EBuildPatchInstallError::MoveFileToInstall: return MoveFileToInstall; case EBuildPatchInstallError::BuildVerifyFail: return BuildVerifyFail; case EBuildPatchInstallError::ApplicationClosing: return ApplicationClosing; case EBuildPatchInstallError::ApplicationError: return ApplicationError; case EBuildPatchInstallError::UserCanceled: return UserCanceled; case EBuildPatchInstallError::PrerequisiteError: return PrerequisiteError; default: return InvalidOrMax; } }
void FAsyncIOSystemBase::BlockTillAllRequestsFinished() { DECLARE_SCOPE_CYCLE_COUNTER(TEXT("FAsyncIOSystemBase::BlockTillAllRequestsFinished"), STAT_FAsyncIOSystemBase_BlockTillAllRequestsFinished, STATGROUP_AsyncIO_Verbose); // Block till all requests are fulfilled. while( true ) { bool bHasFinishedRequests = false; { FScopeLock ScopeLock( CriticalSection ); bHasFinishedRequests = (OutstandingRequests.Num() == 0) && (BusyWithRequest.GetValue() == 0); } if( bHasFinishedRequests ) { break; } else { SHUTDOWN_IF_EXIT_REQUESTED; //@todo streaming: this should be replaced by waiting for an event. FPlatformProcess::SleepNoStats( 0.001f ); } } }
/** Returns current position of stream */ STDMETHODIMP FImfByteStream::GetCurrentPosition( QWORD* pqwPosition ) { FScopeLock ScopeLock( &CriticalSection ); *pqwPosition = Position; return S_OK; }
bool VRPNTrackerInputDevice::GetControllerOrientationAndPosition(const int32 ControllerIndex, const EControllerHand DeviceHand, FRotator& OutOrientation, FVector& OutPosition) const { for(auto &InputPair : TrackerMap) { const TrackerInput &Tracker = InputPair.Value; if(Tracker.PlayerIndex == ControllerIndex && Tracker.Hand == DeviceHand) { if(InputDevice) { FScopeLock ScopeLock(&CritSect); InputDevice->mainloop(); } FVector NewPosition; FQuat NewRotation; TransformCoordinates(Tracker, NewPosition, NewRotation); OutOrientation = NewRotation.Rotator(); OutPosition = NewPosition; return true; } } return false; }