кто подскажет как можно проверить запущен ли код в другом потоке?!запускаю два кода одновременно нужно узнать запущен ли этот код еще гденибудь и сколько раз ?!
![Photo](https://arma3.ru/forums/public/style_images/GreyRed/profile/default_large.png)
потоки
Автор:
lopster102
, 19 Jul 2017 19:31
5 replies to this topic
#1
OFFLINE
Posted 19 July 2017 - 19:31
#2
OFFLINE
Posted 19 July 2017 - 19:51
PS Нах такое извращение то?
#3
OFFLINE
Posted 20 July 2017 - 16:13
fn_process_1 = { // code handle_process_1 = nil; }; fn_process_2 = { // code handle_process_2 = nil; }; handle_process_1 = 0 spawn fn_process_1; handle_process_2 = 0 spawn fn_process_2; if (isNil "handle_process_1") then { // процесс не инициализирован // инициализировать процесс handle_process_1 = 0 spawn fn_process_1; } else { // процесс инициализирован // убить процесс terminate handle_process_1; };
#4
OFFLINE
Posted 20 July 2017 - 22:56
fn_process_1 = { // code handle_process_1 = nil; }; fn_process_2 = { // code handle_process_2 = nil; }; handle_process_1 = 0 spawn fn_process_1; handle_process_2 = 0 spawn fn_process_2; if (isNil "handle_process_1") then { // процесс не инициализирован // инициализировать процесс handle_process_1 = 0 spawn fn_process_1; } else { // процесс инициализирован // убить процесс terminate handle_process_1; };
{
//******************code - x6 раз одновременно***********************///
необходим метод который позволит вычленить 1 из 6 потоков и удалить все остальные
uisleep нельзя использовать внутри кода
}
Edited by lopster102, 20 July 2017 - 23:05.
#5
OFFLINE
Posted 20 July 2017 - 23:39
//FUNC1 //Define global array if not defined if (isNil {missionNamespace getVariable "MyVar"}) then { missionNamespace setVariable ["MyVar", []]; }; //Call target function private _hScript = _this spawn FUNC2; //Save called function (missionNamespace getVariable "MyVar") pushBack _hScript; //Remove first function call by random if ((random 10) > 7) then { terminate ((missionNamespace getVariable "MyVar") deleteAt 0); };PS Я предсатвить себе не могу где такое извращение может пригодиться
Edited by vlad333000, 21 July 2017 - 00:04.
#6
OFFLINE
Posted 21 July 2017 - 04:07
всем спасибо за ответы!Сделал через uisleep все таки.....