Run clang-format

This commit is contained in:
Bassem Girgis
2018-10-18 00:40:34 -05:00
parent fffe4528da
commit 31c32e368a
149 changed files with 5974 additions and 6287 deletions

View File

@@ -1,56 +1,55 @@
#include <thread>
#include <utility>
class scoped_thread
{
std::thread t;
class scoped_thread {
std::thread t;
public:
explicit scoped_thread(std::thread t_):
t(std::move(t_))
{
if(!t.joinable())
throw std::logic_error("No thread");
}
~scoped_thread()
{
t.join();
}
scoped_thread(scoped_thread const&)=delete;
scoped_thread& operator=(scoped_thread const&)=delete;
explicit scoped_thread(std::thread t_) : t(std::move(t_))
{
if (!t.joinable())
throw std::logic_error("No thread");
}
~scoped_thread() { t.join(); }
scoped_thread(scoped_thread const&) = delete;
scoped_thread& operator=(scoped_thread const&) = delete;
};
void do_something(int& i)
void
do_something(int& i)
{
++i;
++i;
}
struct func
{
int& i;
struct func {
int& i;
func(int& i_):i(i_){}
func(int& i_) : i(i_) {}
void operator()()
{
for(unsigned j=0;j<1000000;++j)
{
do_something(i);
}
void operator()()
{
for (unsigned j = 0; j < 1000000; ++j) {
do_something(i);
}
}
};
void do_something_in_current_thread()
{}
void f()
void
do_something_in_current_thread()
{
int some_local_state;
scoped_thread t(std::thread(func(some_local_state)));
do_something_in_current_thread();
}
int main()
void
f()
{
f();
int some_local_state;
scoped_thread t(std::thread(func(some_local_state)));
do_something_in_current_thread();
}
int
main()
{
f();
}