/************************************************************** File: main.cc Description: A program that implements a barrier using a conditional variable from the pthread library. Author: Dana Vrajitoru Organization: IUSB, Computer and Information Sciences Date: September 2020 ***************************************************************/ #include #include #include #include using namespace std; #include "red_barrier.h" int main() { int no_threads; pthread_t *threads; srand(time(NULL)); Init_data(no_threads); threads = new pthread_t[no_threads]; Create_threads(threads, no_threads); Synchronise(threads, no_threads); return 0; } /***************** Example of output ************************* Enter the number of ships in the Red Fleet 10 Red 0 checking in Red 1 checking in Red 2 checking in Red 3 checking in Red 4 checking in Red 5 checking in Red 6 checking in Red 7 checking in Red 8 checking in Red 9 checking in Red 9 standing by Red 0 standing by Red 1 standing by Red 2 standing by Red 5 standing by Red 6 standing by Red 8 standing by Red 7 standing by Red 3 standing by Red 4 standing by **************************************************************/