How to make threads work in a sync?

DoctorStrange

Новичок
Регистрация
30.03.2018
Сообщения
6
Благодарностей
0
Баллы
1
I have a file from which I take lines using the counter variable. The problem however is that even though I'm increasing the counter with +1 each time, all the threads work from the start of the file and do it as many times as there are threads.

For example, if I am using 10 threads, each line is being done 10 times. What can I do to avoid this and make threads work in a sync?
 

zortexx

Client
Регистрация
19.09.2011
Сообщения
2 520
Благодарностей
1 226
Баллы
113

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)