Multithreading!!!

« Older   Newer »
  Share  
FrontBack
CAT_IMG Posted on 9/2/2011, 16:54     +1   -1




Guardate cosa ho trovato nel foro ufficiale di AutoIt:
SPOILER (click to view)
CODICE
_ThreadStart("_Thread1")
_ThreadStart("_Thread2")

MsgBox(0, "", "Mainscript")

Func _Thread1($vDummy)
   MsgBox(0, "", "Thread 1")
EndFunc   ;==>_Thread1

Func _Thread2($vDummy)
   MsgBox(0, "", "Thread 2")
EndFunc   ;==>_Thread2

Func _ThreadStart($sFunctionName)
   Local $h1, $h2, $h3 = DllStructCreate("hwnd[1]"), $h4 = DllStructGetPtr($h3)

   $h1 = DllCallbackRegister($sFunctionName, "int", "int")
   $h2 = DllStructCreate("int")
   $h3 = DllCall("Kernel32.dll", "hwnd", "CreateThread", "ptr", 0, _
           "int", 0, _
           "ptr", DllCallbackGetPtr($h1), _
           "int", 0, _
           "int", 0, _
           "ptr", DllStructGetPtr($h2))
   DllStructSetData($h3, 1, $h3[0], 1)
   DllCall("Kernel32.dll", "int", "CloseHandle", "hwnd", DllStructGetData($h3, 1, 1))
EndFunc   ;==>_ThreadStart


Un multithread funzionante!! :woot:
 
Top
/dev/random
CAT_IMG Posted on 9/2/2011, 17:07     +1   -1




Si vabè, scrive un altro script e lo esegue, non è multithread, e poi le variabili non sono condivise.
E poi è tutt'altro che efficiente...
 
Top
FrontBack
CAT_IMG Posted on 9/2/2011, 17:23     +1   -1




è sempre un passo avanti... XD
 
Top
/dev/random
CAT_IMG Posted on 9/2/2011, 17:39     +1   -1




Beh c'è già da tempo questa UDF comunque...

EDIT: ah no è diverso, questo usa le API di Windows... Beh allora bello xD però è poco avanzato e flessibile :(
 
Top
Cale92
CAT_IMG Posted on 9/2/2011, 17:42     +1   -1




potrebbe sempre ritornare utile...
 
Top
CAT_IMG Posted on 3/9/2012, 22:15     +1   -1
Avatar

So creare belle gui

Group:
Member
Posts:
374
Reputazione:
0
Location:
C:\Windows\System32 \hacktooth.exe

Status:


in verità le variabili vengono condivise guardate il contest algoritmo di paterson fatto da me... ho utilizzato proprio questa udf
 
Top
»Master
CAT_IMG Posted on 3/9/2012, 22:27     +1   -1




CITAZIONE (hacktooth @ 3/9/2012, 23:15) 
in verità le variabili vengono condivise guardate il contest algoritmo di paterson fatto da me... ho utilizzato proprio questa udf

eh, così così in fondo...
 
Top
ZZeman94
CAT_IMG Posted on 9/9/2012, 08:07     +1   -1




a me funziona, ma poi ho provato 8 diverse funzioni e ho messo i loro nomi al posto di trhead 1 e 2, poi ovviamente ho creato altri 6 simili.

Non ho modificato niente della funzione trhead start, ma mi da errore
 
Top
7 replies since 9/2/2011, 16:54   549 views
  Share