コード例 #1
0
ファイル: mutex1.cpp プロジェクト: moogen00/mygit_test
int main() 
{
    //This is the main crowd of people uninterested in making a phone call

    //man1 leaves the crowd to go to the phone booth
    std::thread man1(makeACallFromPhoneBooth);
    //Although man2 appears to start second, there's a good chance he might
    //reach the phone booth before man1
    std::thread man2(makeACallFromPhoneBooth);
    //And hey, man3 also joined the race to the booth
    std::thread man3(makeACallFromPhoneBooth);

    man1.join();//man1 finished his phone call and joins the crowd
    man2.join();//man2 finished his phone call and joins the crowd
    man3.join();//man3 finished his phone call and joins the crowd
    return 0;
}
コード例 #2
0
ファイル: bond.cpp プロジェクト: Vamanan/OpenGlProject
void circle2(float r, int cx, int cy)
{
	int x, y;
	flag1++;
	if (flag1 % 350 == 0)
		flag2++;
	/*for(int i=0;i<50;i++)
	for(int j=0;j<1000;j++)*/	//use in case of slow machines
	glBegin(GL_POLYGON);


	for (int i = 0; i <360; i++)
	{
		float degInRad = i*DEG2RAD;

		x = cx + cos(degInRad)*r;
		y = cy + sin(degInRad)*r;
		glVertex2f(x, y);
	}
	glEnd();


	if (flag2 % 2 != 0 && flag3 == 0)
	{
		man(cx, cy + 30);

	}


	else if (flag2 % 2 == 0 && flag3 == 0)
	{
		man2(cx, cy + 30);
	}
	if (cx <= 400)
	{
		flag3 = 1;
		climax(cx, cy + 30);

		if (climaxflag == 1000)
			bloodflag = 1;


	}

}