Performing tasks from laboratory work. I have about 20 tasks.
Rewrite the enumeration of files in a directory, so that the main thread is enumerated, and on each worker thread 4 each item listed is displayed.
Hint - 4 threads are created that initially wait on an unsigned semaphore. As the main thread enumerates files, they will be queued and the workspace waiting for the worker thread will be signaled. The worker scot threads in the queue an item he displays and returns and waits for the appearance of a new element on the semaphore. The termination of the program can be done by inserting fake tasks (instead of being a valid file name one puts an invalid, which thread worker acknowledging it, coming out).