void function2() { sem.Take(); cout << "This is Second statement, and shall be executed by thread t2 after first statement is executed."<<endl; sem.Give(); }