aboutsummaryrefslogtreecommitdiff
path: root/oop2w4/MijnKlasse.cpp
blob: 55f8af62476043df8380130b6dd4255d7ed79fdd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>

#include "MijnKlasse.h"

MijnKlasse::MijnKlasse(int n) { 
	_n = n;
	_thread = new std::thread(this->showNum, this->_n);
}

MijnKlasse::~MijnKlasse() {
	if (_thread != nullptr) {
		_thread->join();
		delete _thread;
		_thread = nullptr;
	}
}

void MijnKlasse::showNum(int n) {
	std::cout << std::endl << n << " from thread " << std::this_thread::get_id();
}