반응형

 

#include "pch.h"
#include <iostream>
#include "CorePch.h"
#include <thread>	//11부터 thread 가 다른 플랫폼에서도 구현 가능되도롯 멀티플랫폼으로 지원 됨 => linux 에서도 실행 가능
#include <vector>

using namespace std;

void HelloThread(int a)
{
	std::cout << "Hello Thread " << a << std::endl;
}


int main()
{
	vector<std::thread> t;
	t.resize(1);

	auto idtest = t[0].get_id();			//관리하고 있는 스레드가 없다면 id 는 0

	t[0] = std::thread(HelloThread, 10);

	if (t[0].joinable())
	{
		t[0].join();
	}

	std::cout <<" main " << std::endl;

	


	return 0;
}

 

 

반응형

+ Recent posts