Boost thread library allows the implementation of threads in programs.
Thread is a class to represent individual threads of execution.
A thread of execution is a sequence of instructions that can be executed concurrently with the other such sequences in multi-threading environments,while sharing a same address space.
These threads can be executed individually and generate distinct outputs.
HEADER FILES :
In this program ,the header file <thread.hpp> is used to create an executing thread.
using namespace std;
void fun(int x)
std::cout<<"main ,functr and fun now execute concurrently..\n";
std::cout<<"functr and fun completed.\n";
main function(): two threads were created ,thread first and thread second and assigned them with the functions functr
and fun respectively.Then both the threads were executed using join() function.
join function(): join threads(it is a public member function).An initialized thread object represents an active thread
of execution;such a thread object is joinable ,and has a unique thread id.