C# interrupt task (not stop task)

  • Автор темы Автор темы cheekybot
  • Дата начала Дата начала

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?
 
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?
 
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
 
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...
 
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
 
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.
 
#2 is not what I'm talking about..

Just need something like this:

ZennoPoster.StopTask(name);

but make one like:

ZennoPoster.InterruptTask(name);
 

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