示例#1
0
文件: service.c 项目: AndreRH/wine
/* Service entry point */
VOID WINAPI
ServiceMain(DWORD dwArgc, LPWSTR *lpszArgv)
{
    HANDLE fileTxThread;
    static const WCHAR qmgr_nameW[] = {'B','I','T','S',0};
    DWORD threadId;
    TRACE("\n");

    stop_event = CreateEventW(NULL, TRUE, FALSE, NULL);
    if (!stop_event) {
        ERR("failed to create stop_event\n");
        return;
    }

    status_handle = RegisterServiceCtrlHandlerExW(qmgr_nameW, ServiceHandler, NULL);
    if (!status_handle) {
        ERR("failed to register handler: %u\n", GetLastError());
        return;
    }

    UpdateStatus(SERVICE_START_PENDING, NO_ERROR, 3000);
    if (!StartCount()) {
        ERR("failed starting service thread\n");
        UpdateStatus(SERVICE_STOPPED, NO_ERROR, 0);
        return;
    }

    globalMgr.jobEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
    if (!globalMgr.jobEvent) {
        ERR("Couldn't create event: error %d\n", GetLastError());
        UpdateStatus(SERVICE_STOPPED, NO_ERROR, 0);
        return;
    }

    fileTxThread = CreateThread(NULL, 0, fileTransfer, NULL, 0, &threadId);
    if (!fileTxThread)
    {
        ERR("Failed starting file transfer thread\n");
        UpdateStatus(SERVICE_STOPPED, NO_ERROR, 0);
        return;
    }

    UpdateStatus(SERVICE_RUNNING, NO_ERROR, 0);

    WaitForSingleObject(fileTxThread, INFINITE);
    UpdateStatus(SERVICE_STOPPED, NO_ERROR, 0);
    CloseHandle(stop_event);
    TRACE("service stopped\n");

    CoUninitialize();
}
示例#2
0
文件: task2.cpp 项目: annhv/parp
void bubbleSort(int* arr, int n){
	StartCount();
	for (int i = 0; i < n - 1; i++){
		for (int j = 0; j < n - 1 - i; j++){
			if (arr[j] > arr[j + 1])
			{
				int temp = arr[j];
				arr[j] = arr[j + 1];
				arr[j + 1] = temp;
			}
		}
	}
	__int64 time = EndCount();
	_tprintf(_T("time of invoking:\t\t%I64d\n"), time);
}
示例#3
0
文件: task2.cpp 项目: annhv/parp
void bubbleSortOptimised(int* arr, int n){
	StartCount();
	for (int i = 0; i< n - 1; i++){
		for (int j = i; j >= 0; j--){
			if (arr[j] > arr[j + 1])
			{
				int temp = arr[j];
				arr[j] = arr[j + 1];
				arr[j + 1] = temp;
			}
		}
	}
	__int64 time = EndCount();
	_tprintf(_T("time of invoking [optimised]:\t%I64d\n"), time);
}
示例#4
0
//------------------------------------------------------------------------------
// 
//------------------------------------------------------------------------------
// 引数
//  なし
// 戻り値
//  なし
//------------------------------------------------------------------------------
void CGame::Update(void)
{
	VC* vc = VC::Instance();
	// 最初のカウントダウン
	StartCount();


	// 空の位置プレイヤーに合わせる
	Sky->SetPosX(Player[CManager::netData.charNum]->Pos().x);
	Sky->SetPosZ(Player[CManager::netData.charNum]->Pos().z);
	for (int loop = 0;loop < PLAYER_MAX;loop++)
	{
		if (Player[loop]->PlayerLife() <= 0)
		{
			VECTOR3	NormalGround;		// 地形の法線
			VECTOR3 Respawn = VECTOR3(rand() % 100 + 0.0f,0,rand() % 100 + 0.0f);
			Respawn.y = Ground->GetHeight(Respawn,&NormalGround);

			Player[loop]->SetDeath(Respawn, loop);
		}
	}
	// 攻撃判定
	CheckHitPlayer();

	// 攻撃判定
	CheckHitRock();

	// キャラクター同士の押し戻し
	PushBackCharacter();

	// キャラクターと岩の押し戻し
	PushBackRock();

	// 地形との押し戻し
	PushBackField();

	// 地形との判定
	IsLandField();

	// 行動可能範囲判定
	PushBackBattleArea();

	// 着弾地点判定
	HitBulletToField();

	// 影を合わせる
	for (int cntShadow = 0; cntShadow < PLAYER_MAX; ++cntShadow)
	{
		VECTOR3	positionShadow = Player[cntShadow]->Pos();
		positionShadow.y -= HEIGHT_PLAYER_TO_FIELD;
		Shadow[cntShadow]->SetPos(positionShadow);
		PushBackObjectByField(Shadow[cntShadow], 1.0f);
	}
	for (int cntShadow = 0; cntShadow < PLAYER_MAX; ++cntShadow)
	{
		if (NeedsSkipBullet(Player[cntShadow]))
		{
			Shadow[cntShadow + PLAYER_MAX]->SetPos(VECTOR3(0.0f, 1000.0f, 0.0f));
			continue;
		}
		VECTOR3	positionShadow = Player[cntShadow]->Bullet()->Pos();
		Shadow[cntShadow + PLAYER_MAX]->SetPos(positionShadow);
		PushBackObjectByField(Shadow[cntShadow + PLAYER_MAX], 1.0f);
	}

	// UIのアップデート
	UI->Update();

 if(CKeyboard::Instance()->GetTrigger(DIK_F1))
 {
  CManager::ChangeScene(SCENE_RESULT);
 }
}