bool UPawnAction::Activate() { bool bResult = false; UE_VLOG(GetPawn(), LogPawnAction, Log, TEXT("%s> Activating at priority %s! First start? %s Paused? %s") , *GetName() , *GetPriorityName() , HasBeenStarted() ? TEXT("NO") : TEXT("YES") , IsPaused() ? TEXT("YES") : TEXT("NO")); if (HasBeenStarted() && IsPaused()) { bResult = Resume(); } else { bResult = Start(); if (bResult == false) { UE_VLOG(GetPawn(), LogPawnAction, Log, TEXT("%s> Failed to start.") , *GetName()); bFailedToStart = true; SetFinishResult(EPawnActionResult::Failed); SendEvent(EPawnActionEventType::FailedToStart); } } return bResult; }
void SimpleThread::Start() { DCHECK(!HasBeenStarted()) << "Tried to Start a thread multiple times."; bool success = PlatformThread::Create(options_.stack_size(), this, &thread_); DCHECK(success); base::ThreadRestrictions::ScopedAllowWait allow_wait; event_.Wait(); // Wait for the thread to complete initialization. }
bool UPawnAction_BlueprintBase::Start() { const bool bHasBeenEverStarted = HasBeenStarted(); const bool bSuperResult = Super::Start(); if (bHasBeenEverStarted == false && bSuperResult == true) { ActionStart(GetPawn()); } return bSuperResult; }
void SimpleThread::Join() { DCHECK(HasBeenStarted()) << "Tried to Join a never-started thread."; DCHECK(!HasBeenJoined()) << "Tried to Join a thread multiple times."; PlatformThread::Join(thread_); joined_ = true; }
SimpleThread::~SimpleThread() { DCHECK(HasBeenStarted()) << "SimpleThread was never started."; DCHECK(HasBeenJoined()) << "SimpleThread destroyed without being Join()ed."; }