Multithread & Duplicate Actions

Adé

Пользователь
Регистрация
05.03.2015
Сообщения
31
Благодарностей
1
Баллы
8
Hi all !

I'm testing a new template with multithread, and i'm not sure if it's ok.

I want to extract all txt files from a directory in my computer and put them to a list in zenno.

Monothread it's ok because all txt will be treated only one time.

But what if I use multithread ? I mean if I launch 5 threads, same txt files will be extracted to 5 lists. It mean that same work will be done on the same texts 5 times. There's no way to delete the txt file treated on all threads ? this way there's no duplicate work on all threads.

Not sure if i make myself understood :-)

Let me know.
upload_2019-6-11_23-23-17.png
 

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 770
Благодарностей
1 182
Баллы
113

Adé

Пользователь
Регистрация
05.03.2015
Сообщения
31
Благодарностей
1
Баллы
8
Hi Lokiys !

Thanks for your answer.

Yes, I agree with you, but in that case, first thread will extract all txt files. The others others threads won't have anything to exract ? Am I wrong ?
 

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 770
Благодарностей
1 182
Баллы
113
Hi Lokiys !

Thanks for your answer.

Yes, I agree with you, but in that case, first thread will extract all txt files. The others others threads won't have anything to exract ? Am I wrong ?

It is your logic after that, you can make as You need. If You want to take all and work with all files in one thread then You can do that. I'm totally blind here as I do not know what is your requirements.
If You want to work with one file in one thread then take just one random file from that folder and delete, then other threads also will take a random file and work with it.
Hope that helps
 

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