How to terminate a threads in another thread?how to Accessing a variable of a thread from another thread ? Topic is solved

Post AHK_H specific scripts & libraries and discuss the usage and development of HotKeyIt's fork/branch
gameba
Posts: 18
Joined: 20 Mar 2018, 12:24

How to terminate a threads in another thread?how to Accessing a variable of a thread from another thread ?

24 Jun 2018, 20:59

Hi, pls help
1)How to terminate a threads from another thread?
2)How to Accessing a variable of a thread from another thread ?
I read document at here https://hotkeyit.github.io/v2/docs/comm ... getvar.htm and here https://hotkeyit.github.io/v2/docs/comm ... minate.htm but It work only in maincode, not work in a thread

I use AHK_H v1 64bit

Code: Select all

global threads:=[]
Loop 8
threads[A_Index]:=AhkThread("
(

**Do something**
if(Dosomething = "true"){
	
	threads[2].ahkterminate[]
}

 
)")
Thanks for watching!
HotKeyIt
Posts: 1697
Joined: 29 Sep 2013, 18:35
Contact:

Re: How to terminate a threads in another thread?how to Accessing a variable of a thread from another thread ?  Topic is solved

25 Jun 2018, 16:21

Code: Select all

global threads:=CriticalObject()
Loop 3
threads[A_Index]:=AhkThread("
(
#Persistent
global  threads:=CriticalObject(" (&threads) ")
if (" A_Index ">1)
MsgBox `% threads.1.ahkgetvar(""test"")
else test:=""Hello World!""
if (" A_Index ">2)
	threads.2.ahkterminate()
 )")
While threads.2.ahkReady()
	Sleep 100
MsgBox End

Return to “AutoHotkey_H”

Who is online

Users browsing this forum: No registered users and 1 guest