Пример #1
0
DWORD WINAPI CTranscendenceWnd::BackgroundThread (LPVOID pData)

//	BackgroundThread
//
//	Background thread

	{
	CTranscendenceWnd *pThis = (CTranscendenceWnd *)pData;

	while (true)
		{
		//	Wait for work to do

		::WaitForSingleObject(pThis->m_hWorkAvailableEvent, INFINITE);

		//	Do the work

		switch (pThis->m_iBackgroundState)
			{
			case bsQuit:
				return 0;

			case bsLoadUniverse:
				pThis->BackgroundLoadUniverse();
				pThis->m_bLoadComplete = true;
				break;

			case bsCreateGame:
				pThis->BackgroundNewGame();
				pThis->m_bGameCreated = true;
				break;

			default:
				ASSERT(false);
			}

		//	Reset

		::ResetEvent(pThis->m_hWorkAvailableEvent);
		pThis->m_iBackgroundState = bsNone;
		}
	}
Пример #2
0
int CTranscendenceWnd::BackgroundThread (LPVOID pData)

//	BackgroundThread
//
//	Background thread

	{
	CTranscendenceWnd *pThis = (CTranscendenceWnd *)pData;

	while (true)
		{
		//	Wait for work to do

		SDL_SemWait(pThis->m_hWorkAvailableEvent);

		//	Do the work

		switch (pThis->m_iBackgroundState)
			{
			case bsQuit:
				return 0;

			case bsLoadUniverse:
				pThis->BackgroundLoadUniverse();
				break;

			case bsCreateGame:
				pThis->BackgroundNewGame();
				break;

			default:
				return 0;
			}

		//	Reset

		pThis->m_iBackgroundState = bsNone;
		}
	}