Initial import

This commit is contained in:
Matteo Settenvini 2019-07-27 18:28:47 +02:00
commit 0a5348b401
31 changed files with 1907 additions and 0 deletions

31
exercises/src/a.cc Normal file
View file

@ -0,0 +1,31 @@
#include <cmake-exercise/a.hh>
#include <chrono>
#include <cstdlib>
#include <iostream>
#include <sstream>
A::A ()
: _t ([] ()
{
{
std::ostringstream oss;
oss << "Starting thread " << std::this_thread::get_id () << std::endl;
std::cout << oss.str() << std::flush;
}
std::this_thread::sleep_for (std::chrono::milliseconds(std::rand() % 100 * 10));
{
std::ostringstream oss;
oss << "Thread " << std::this_thread::get_id () << " finished" << std::endl;
std::cout << oss.str() << std::flush;
}
})
{
}
A::~A ()
{
_t.join ();
}

7
exercises/src/b.cc Normal file
View file

@ -0,0 +1,7 @@
#include <cmake-exercise/b.hh>
#include <cmake-exercise/c.hh>
B::B ()
: _a (10)
{
}