It is necessary for the thread t4 to wait for the time rendering event "time = 1000 * (getTime () - time);" and after that started. How to implement? Event is needed (such a task)

// Get start time long time = getTime(); // Thread procession thread t1(process, filenames, 0); thread t2(process, filenames, 1); thread t3(process, filenames, 2); thread t4(foutput, "Time total", "", time); // Join t1.join(); t2.join(); t3.join(); // Get total time // Здесь должен быть Event time = 1000 * (getTime() - time); // Здесь должна сработать нить t4 t4.join(); 
  • 2
    It is better to make a delay in the thread itself, and not in the trigger, and even after join() - which is not clear when it will end. Well, understand your time = 1000 * (getTime() - time); - I personally miss. Explain more clearly what you want? ... - Harry
  • t1, t2, t3 - Handle arrays of numbers in files. time = 1000 * (getTime () - time); - considers the time spent on all threads. t4 - writes time to file. The task is to synchronize threads using Event. I don’t know where to push this Event, so I decided that the t4 stream should wait for the events “flows 1-3 ended, the time was calculated” then the flow 4 starts.

0