Which is the correct method to end a thread started with AhkThread()?

Ask for help, how to use AHK_H, etc.
User avatar
yane
Posts: 3
Joined: 12 May 2018, 01:48

Which is the correct method to end a thread started with AhkThread()?

20 Aug 2019, 08:17

I am using AHK_H v1

Which is the correct method to end a thread started with AhkThread()?
Are there there any pros/cons to each of the methods?

Any suggestion is welcome.

Code: Select all

thread.ahkterminate()
;or

ahkthread_free(thread)
thread := ""
;or

thread.ahkFunction("myExitThreadFunction")

;where myExitThreadFunction() would be defined in the thread something in the lines of
 myExitThreadFunction()
{
  Tooltip,,This thread is closing
  Sleep, 1000
  ExitApp
}
swagfag
Posts: 3005
Joined: 11 Jan 2017, 17:59

Re: Which is the correct method to end a thread started with AhkThread()?

20 Aug 2019, 12:41

AhkTerminate() id imagine. AhkThread_Free() will get the job done too, but it will also unload the module, so if u spawn any new threads after that, it will incur a slight performance penalty. that isnt to say it doesnt have its uses, but i dont think this is one of them.

the last one seems like a total waste of time and effort, so i wouldnt bother with it

Return to “Ask For Help”

Who is online

Users browsing this forum: No registered users and 4 guests