//
// Activate / Stop the thread 
//
void CCustomThread::SetActive(BOOL bValue)
{
	BOOL bCurrent = GetIsActive();

	if (bValue != bCurrent)
	{
		if (!bCurrent)
		{
			//
			// Perform action prior to activate the thread
			//
			if (!OnBeforeActivate())
				return;

			if (0 != _tcslen(m_szThreadGuid))
				m_hShutdownEvent = ::CreateEvent(NULL, FALSE, FALSE, m_szThreadGuid);
			ULONG ulResult = _beginthreadex(
				(void *)NULL,
				(unsigned)0,
				(PTHREAD_START)CCustomThread::ThreadFunc,
				(PVOID)this,
				(unsigned)0,
				(unsigned *)&m_dwThreadId
				);
			if (ulResult != -1)
				//
				// Wait until the thread gets activated
				//
				while (!GetIsActive())
				{
				}
		} 
		else
		{
			if ( GetIsActive() )
			{
				if (NULL != m_hShutdownEvent)
					//
					// Signal the thread's event
					//
					::SetEvent(m_hShutdownEvent);
				//
				// Wait until the thread is done
				//
				while (GetIsActive())
				{
				}
				//
				// Called after the thread function exits
				//
				OnAfterDeactivate();
			} // if
			if (NULL != m_hShutdownEvent)
				::CloseHandle(m_hShutdownEvent);
		}
	} // if
}
Ejemplo n.º 2
0
mitk::ServiceProperties mitk::USDevice::ConstructServiceProperties()
{
  ServiceProperties props;
  std::string yes = "true";
  std::string no = "false";

  if(this->GetIsActive())
    props[mitk::USDevice::US_PROPKEY_ISACTIVE] = yes;
  else
    props[mitk::USDevice::US_PROPKEY_ISACTIVE] = no;

  std::string isActive;
  if (GetIsActive()) isActive = " (Active)";
  else isActive = " (Inactive)";
  // e.g.: Zonare MyLab5 (Active)
  props[ mitk::USDevice::US_PROPKEY_LABEL] = m_Metadata->GetDeviceManufacturer() + " " + m_Metadata->GetDeviceModel() + isActive;

  if( m_Calibration.IsNotNull() )
    props[ mitk::USImageMetadata::PROP_DEV_ISCALIBRATED ] = yes;
  else
    props[ mitk::USImageMetadata::PROP_DEV_ISCALIBRATED ] = no;

  props[ mitk::USDevice::US_PROPKEY_CLASS ] = GetDeviceClass();
  props[ mitk::USImageMetadata::PROP_DEV_MANUFACTURER ] = m_Metadata->GetDeviceManufacturer();
  props[ mitk::USImageMetadata::PROP_DEV_MODEL ] = m_Metadata->GetDeviceModel();
  props[ mitk::USImageMetadata::PROP_DEV_COMMENT ] = m_Metadata->GetDeviceComment();
  props[ mitk::USImageMetadata::PROP_PROBE_NAME ] = m_Metadata->GetProbeName();
  props[ mitk::USImageMetadata::PROP_PROBE_FREQUENCY ] = m_Metadata->GetProbeFrequency();
  props[ mitk::USImageMetadata::PROP_ZOOM ] = m_Metadata->GetZoom();

  return props;
}
Ejemplo n.º 3
0
//---------------------------------------- Render --------------------------------------------
// Render bullet if it is active.
//--------------------------------------------------------------------------------------------
void Bullet::Render(float xPos, float yPos) 
{
	if (GetIsActive())
	{
		// Draw Bullet
		GameObject::Render(xPos, yPos) ;
	}// end if
}
Ejemplo n.º 4
0
bool CGuiWidget::DoRegisterEventHandler()
{
    if (xf6_28_eventLock || !GetIsActive())
        return false;
    for (auto& item : xcc_triggerMap)
        for (std::unique_ptr<CGuiLogicalEventTrigger>& trigger : *item.second)
            xc8_frame->AddMessageMap(trigger.get(), x7c_selfId);
    return false;
}
Ejemplo n.º 5
0
//---------------------------------------- Update --------------------------------------------
// Updates bullet if it is active. Decrements mBulletTime each frame, when mBulletTime is 
// less than zero the bullet is deactivated.
//--------------------------------------------------------------------------------------------
void Bullet::Update(float frameTime, int levelXSize, int levelYSize)
{
	if (GetIsActive())
	{
		// Update Bullet, if it collides with the edge of the map/level, deactivate it
		GameObject::Update(frameTime, levelXSize, levelYSize, true) ;

		mBulletTime-- ;
		if (mBulletTime < 0)
		{
			mIsActive = false ;

		}
	}// end if
}