[class][v1/v2] threadFunc

Post your working scripts, libraries and tools for AHK v1.1 and older
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

[class][v1/v2] threadFunc

06 Oct 2017, 06:10

Introduction
This is a simple custom function object which enables you to call a function in a new autohotkey thread.

Documentation
Documentation and motivation are available in the github :arrow: wiki.

Fun
I think it is nice to be able to do this, but the general interest for this is probably low. However, for those of you who thinks it is fun to tinker with autohotkey-language specifics, I recommend you try to write such a function object yourselves. I'd be interested in seeing other ideas. :superhappy:

Misc
Feel free to use this in whichever modified or non-modified state you wish, for any peaceful purpose. No credits or references needed.

Have fun and good luck :wave:
User avatar
kczx3
Posts: 1640
Joined: 06 Oct 2015, 21:39

Re: [class][v1/v2] threadFunc

06 Oct 2017, 19:31

Could this be used to run a query via ADO outside of the main process and then do something as a callback when the query returns? Hoping this would avoid the main script from becoming unresponsive with longer query executions.
User avatar
runie
Posts: 304
Joined: 03 May 2014, 14:50
Contact:

Re: [class][v1/v2] threadFunc

06 Oct 2017, 20:20

Does it basically do something like SetTimer, label, -1? Or am I missing the point here :o
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: [class][v1/v2] threadFunc

07 Oct 2017, 12:31

Hello, thanks for responding.

@ kczx3, I know nothing about that. My guess is no though, this has nothing to do with running something outside of the main process. It is about causing a function to be called in a new thread.
@ RUNIE, in the sense that SetTimer cause the target label or function to execute in a new thread, yes, that is the main point. There is one line causing the new thread, the rest of the code if for handling the passing of parameters, retrieving the returns and setting the new thread options.

I leave it as an exercise for the interested reader to work out the significant differences between using SetTimer and dllcall + registerCallback, to start a new thread.

Cheers :)

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 131 guests