Skip to content

spopa01/cpp_playground

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 

Repository files navigation

cpp_playground

Just a playground... exercising my inner child

cpp_concurrency (in action):

//g++ have_fun.cpp -std=c++11 -lpthread

#include <iostream>
#include <thread>
#include <atomic>
#include <chrono>

int main( /*...*/ ){
  std::atomic<bool> pause {true};
  //children are playing...
  std::thread child([&pause](){ while( pause ){ std::cout << "Have fun..." << std::endl; } });
  //so the parents can sleep...
  std::this_thread::sleep_for( std::chrono::milliseconds(1) );
  pause = false;
  child.join();
  std::cout << "Go back to lessons..." << std::endl;
  return 0;
}

About

Just a playground... exercising my inner child...

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages