I know adding multithreading in autoit won't happen anytime soon and i am ok with that with experience we learn to use 2, 3 event more .exe
but how about running multiple autoit into 1 process ,
AutoitVirtualProcessSharedMemory = a array maybe all virtualprocess have access,i think autoit dev know better than me what todo here , a array of mixed value could be great , since the user can define a Global enum and easely keep track of meaning of each index
$VP_index(used to maybe to close that thread) = AutoitCreateVirtualProcess() : this function will start a new autoit thread inside the same process and execute another copy of our script , like if we run it for the first time, so no worry about not safe in multithreading
@VirtualProcessCount will be == to your thread count Created
@VirtualProcess == current running thread
if @VirtualProcess = 1 then thread1()
if @VirtualProcess = 2 then thread2()
func thread1()
while 1
;mutex
while AutoitVirtualProcessSharedMemory[$_DB_COMMAND_IN] <> ""
wend
AutoitVirtualProcessSharedMemory[$_DB_COMMAND_IN] = "my db command"
If AutoitVirtualProcessSharedMemory[$_DB_COMMAND_OUT] = "for me" Then
DoSomething()
EndIf
wend
endfunc
func thread2()
if AutoitVirtualProcessSharedMemory[$_DB_COMMAND_IN] <> "" then
Local $command = AutoitVirtualProcessSharedMemory[$_DB_COMMAND_IN]
AutoitVirtualProcessSharedMemory[$_DB_COMMAND_IN] = "" ;delete as soon as possible to free my mutex
Local $result = MySQL($command)
;mutex
While AutoitVirtualProcessSharedMemory[$_DB_COMMAND_OUT] <> ""
WEnd
AutoitVirtualProcessSharedMemory[$_DB_COMMAND_OUT] = $result
endif
endfunc
Func AnotherFunction()
EndFunc
i hope i am making sence