C# interrupt task (not stop task)

cheekybot

Client
Регистрация
19.09.2014
Сообщения
36
Благодарностей
3
Баллы
8
I'm working with global vars and multiple tasks running infinite loop.. Sometimes I need to stop task and restart all threads with global var reset to 0. Possible to include this or alter stop task to force threads to quit?
 

Nick

Client
Регистрация
22.07.2014
Сообщения
1 983
Благодарностей
817
Баллы
113
How about adding a block that checks for some flag (a file or a global variable value) and exits by itself? You could set this flag from the outside and wait till it all stops by itself. Or wouldn't it be quick enough?
 

cheekybot

Client
Регистрация
19.09.2014
Сообщения
36
Благодарностей
3
Баллы
8
I tried setting a flag using another task and file in folder as well as a last resort.. result is too slow for large scripts and running a lot of threads sometimes have 1 or 2 instances not load/progress. If looping to check when all instances are closed, the sequence will get stuck or take a really long time to finish with many threads
 

Nick

Client
Регистрация
22.07.2014
Сообщения
1 983
Благодарностей
817
Баллы
113
It's hard to offer something else.. you might try a global variable instead of a file ot make it faster; another thing is to insert checks more often in your code that it is reached quicker. I guess you already tried, but still...
 

cheekybot

Client
Регистрация
19.09.2014
Сообщения
36
Благодарностей
3
Баллы
8
Not an effective work around for larger scripts.. I've tried additional checks but the time to do a full loop can double or triple depending if you make complex scripts like live chat responders. A C# interrupt function would go natural with the stop function.. I'm not sure why it's not available by default
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 715
Баллы
113
1) Change you C# code which you use for loop to make it work like you need.
2) Interruption of C# code by right click on project in PM will not be developed.
 

cheekybot

Client
Регистрация
19.09.2014
Сообщения
36
Благодарностей
3
Баллы
8
#2 is not what I'm talking about..

Just need something like this:

ZennoPoster.StopTask(name);

but make one like:

ZennoPoster.InterruptTask(name);
 

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