Created
March 16, 2019 22:28
-
-
Save ahupowerdns/f208d0dc009b702fe7320f41ccac1c37 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// g++ syncio.cc -o syncio -std=c++11 | |
#include <iostream> | |
#include <thread> | |
#include <string> | |
#include <unistd.h> | |
using namespace std; | |
void theThread() | |
{ | |
for(int counter = 0 ;; ++counter) { | |
usleep(250000); | |
cout << "Hi "<< counter << endl; | |
} | |
} | |
int main() | |
{ | |
std::ios_base::sync_with_stdio(false); | |
//cin.tie(nullptr); | |
string line; | |
thread t(theThread); | |
while(getline(cin, line)) | |
; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment