Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- /*
- * File: main.cpp
- * Author: student
- *
- * Created on 2 marca 2018, 12:19
- */
- #include <stdlib.h>
- #include <iostream>
- #include <boost/thread/thread.hpp>
- using namespace std;
- using namespace boost;
- /*
- *
- */
- const int opoznienie = 100;
- int licznik = 50;
- class Watek{
- private:
- int numer;
- public:
- Watek(int _numer): numer(_numer){
- }
- void operator()(){
- while(licznik > 0){
- cout<<"W:" <<numer <<" L: "<< licznik<< endl;
- --licznik;
- this_thread::sleep_for(chrono::microseconds(opoznienie));
- }
- }
- };
- int main2(int argc, char** argv) {
- thread w1(Watek(1));
- thread w2(Watek(2));
- w1.join();
- w2.join();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement