Get number of threads and then make action in one of them

bossofboss

Новичок
Регистрация
06.07.2023
Сообщения
6
Благодарностей
0
Баллы
1
Hello

Great posts, most in russian. But i couldnt find the whole solution. I need to run 5 threads, but only in one of them go to page(which will reset proxy) how can i achive that?

i will check number of threads like that:

var Id = Guid.Parse(project.TaskId);
int currentTaskThreadsById = ZennoPoster.GetThreadsCount(Id);
return currentTaskThreadsById;

Will wait until 5 are open then i need to reset proxy(via open page) in only one of them.

BR
 

myndeswx

Client
Регистрация
15.05.2017
Сообщения
424
Благодарностей
99
Баллы
28
use 'global variable', it would have 3 states 1- need to rotate , 2- rotating, 3- ready
any thread that starts should check the state of that global variable, if it needs to rotate- start rotation and set value to 'rotating'
if rotating - just wait until it's ready
 
  • Спасибо
Реакции: Pierre Paul Jacques

bossofboss

Новичок
Регистрация
06.07.2023
Сообщения
6
Благодарностей
0
Баллы
1
Hmm thats not the best solution. Because i cannot start more threads before the first 5 does not end. I tried few solutons none is working 100%.

Maybe i will catch attempts count. So setup 5 threads and attempts count to 0. Start script. Make attempts count the same as maximum threads. Wait untill attempts count equals 0, make reset proxy, make attempts count the same as maximum threads.

How can i catch attempts count? and get maximum threads number? in c# @myndeswx
 

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