jugador Posted February 10 Share Posted February 10 (edited) Read more about CriticalSection: https://learn.microsoft.com/en-us/windows/win32/sync/critical-section-objects CriticalSection UDF.au3 Edited March 3 by jugador Link to comment Share on other sites More sharing options...
jugador Posted February 10 Author Share Posted February 10 (edited) Tested Op code on 500 thread time taken ==> 28ms to test.... if it worked for you just change the $no_Thread Local $no_Thread = 500 and edit the loop to Local $hTimer = TimerInit() While 1 If $thread_Count = UBound($h_CreateThread) Then ExitLoop Endif WEnd Local $fDiff = TimerDiff($hTimer) MsgBox(0, "Time Difference", $fDiff) ;~ 28 and don't forget to comment out the _ArrayDisplay or you have to click 500 times point to be noted: Msgbox within inner loop not imp so I remove it side note: forum member sought for Multithreading but no comment about if it worked or not after posted Edited February 10 by jugador Link to comment Share on other sites More sharing options...
water Posted February 10 Share Posted February 10 Runnign your code just works fine for me. Setting the # of threads to 500 returns: 669 ms on a Windows 7 VirtualBox machine running AutoIt 3.3.16.1. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
argumentum Posted February 10 Share Posted February 10 10 hours ago, jugador said: there may be other point that can make your code crash tested the original post and got me a "!>15:16:23 AutoIt3 ended. rc:-1073741819" 2nd post !>15:19:11 AutoIt3 ended. rc:-1073740940 removed "_ArrayDisplay", same. Tested as x32 and x64, OS:WIN_10/2009 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Andreik Posted February 10 Share Posted February 10 Doesn't work either on Win 11. Anyway, any real use for this? When the words fail... music speaks. Link to comment Share on other sites More sharing options...
jugador Posted February 11 Author Share Posted February 11 @water I dont know why that much time difference but you can see the performance difference (Multithreading vs no Multithreading) Local $hTimer = TimerInit() Local $Array[100][10] Local $no_loop = 500 For $m = 1 To $no_loop For $i = 1 To UBound($Array) - 1 For $k = 1 To UBound($Array, 2) - 1 $Array[$i][$k] = "Hello - world" $Array[$i][$k] = StringToBinary($Array[$i][$k]) Next Next Next Local $fDiff = TimerDiff($hTimer) MsgBox(0, "Time Difference", $fDiff) @argumentum I hope you have not make any changes in the op code. I tested on win 7 and I get error rc:-1073741819 when I use sleep or Array size to big. otherwise it run smooth for me. so for debug purpose on win10 change Local $no_Thread = 1 and in child thread change this Local $Array[100][10] For $i = 1 To UBound($Array) - 1 For $k = 1 To UBound($Array, 2) - 1 $Array[$i][$k] = "Hello - world" $Array[$i][$k] = StringToBinary($Array[$i][$k]) Next Next to this and then increase the array size gradually to see at which point you are getting @error Local $Array[1[1] ;<<===== For $i = 1 To UBound($Array) - 1 For $k = 1 To UBound($Array, 2) - 1 ; $Array[$i][$k] = "Hello - world" ; $Array[$i][$k] = StringToBinary($Array[$i][$k]) Next Next if that still not solved the problem then google why getting error using CriticalSection on win10? and Do post your debug result Link to comment Share on other sites More sharing options...
argumentum Posted February 11 Share Posted February 11 1 minute ago, jugador said: I hope you have not make any changes in the op code Why do you think that I know machine code or assembly or anything other than copy'n'paste ! And all these chunks, .. nope. The way to go about it is to post running code. 3 minutes ago, jugador said: if that still not solved the problem then google why... Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
jaberwacky Posted March 3 Share Posted March 3 I have noticed that when I run these multithreading -- I'll call them emulations in an attempt to not rile feathers and which seem to work well for everyone else they however always result in a "AutoIt3.exe ended.rc:-1073741819" for me. I hope that sentence wasn't too oddly structured for non native speakers. I feel that it might be. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
jugador Posted March 3 Author Share Posted March 3 To avoid confusion what this thread about change title and edit op post. Autoit not support Multithreading so this type of error normal you can try _WinAPI_WaitForSingleObject multithreading only possible if Autoit developer support this via external dll. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now