@ptt-bds à chào bác, hiện mình không có tham gia nhóm nào về BAS hết bạn, m tự nghiên cứu + tham gia diễn đàn + kết hợp với 1 số pro thôi bác à.
Is there way to know how many threads are running now in parrallell with the given thread?
-
@fox is there way to know how many threads are running now in parrallell with the given thread?
If there is, would want to use it for sort of OnApplicationFinish mechanism by making 1 thread just check once a while if no other threads are running and only then act -
@111cbt111 said in Is there way to know how many threads are running now in parrallell with the given thread?:
@fox is there way to know how many threads are running now in parrallell with the given thread?
If there is, would want to use it for sort of OnApplicationFinish mechanism by making 1 thread just check once a while if no other threads are running and only then actWhy did you specify me in your question?
-
@fox Because you have dealt with this type of issue and even posted the script with way to do similar thing with the usage of async function result action that is able to retreive if THREAD_IS_RUNNING, so i want to know maybe there is option to retreive this information about threads of all script not just the ones that are started with call function asinchronously
@Fox said in Лайфхаки BAS:Управление количеством потоков.
На случай, если кому то нужно управлять количеством потоков во время работы скрипта, я создал пример реализации управления количеством потоков из текстового файла с использованием модуля "Асинхронный вызов функции":

-
@111cbt111 said in Is there way to know how many threads are running now in parrallell with the given thread?:
@Fox alternativly is there way to know thread id (not thread number) ?
ScriptWorker.GetCurrentAction() -
@111cbt111 said in Is there way to know how many threads are running now in parrallell with the given thread?:
@sergerdn said in Is there way to know how many threads are running now in parrallell with the given thread?:
ScriptWorker.GetCurrentAction()
this returns id of the current action not the id of current thread

-
@sergerdn said in Is there way to know how many threads are running now in parrallell with the given thread?:

thanks for the interest but this one returns the index like 1, 5 etc.(the number of thread) not the id of the thread
in the code of @fox above the action of "Get async function result" returns the id of the thread which is used to keep track which threads are active and which are finished working


-
@111cbt111 said in Is there way to know how many threads are running now in parrallell with the given thread?:
Because you have dealt with this type of issue and even posted the script with way to do similar thing with the usage of async function result action that is able to retreive if THREAD_IS_RUNNING, so i want to know maybe there is option to retreive this information about threads of all script not just the ones that are started with call function asinchronously
No, such information can be obtained only when using the module or when creating streams through the web interface
-
@111cbt111 said in Is there way to know how many threads are running now in parrallell with the given thread?:
@Fox thanks. Is there way arround without using the module to do some actions after all the threads finished working?
Yes, use the "Call function in several threads" action, I have given many times on the forum an example of implementing functions of the "OnApplicationEnd" analogue