Jump to content

Recommended Posts

Posted

I've seen some weird behavior in my code (I log almost everything).


 

   While 1
      $WaitingTime = TimerDiff($wtTimer)
      sleep(300)
      $Data = TCPRecv($MainSocket, $MaxLength)
      _FileWriteLog($LogFolder&"info.log", "Wait for answer that Server is ready for step 21")
              

            If $Data = "ByeBye" Then
                                       _FileWriteLog($LogFolder&"info.log", "Server tells me to shutdown")
                                       Terminate()

                 ElseIf $Data = "Step 20 Finished on Server" Then
                                        _FileWriteLog($LogFolder&"info.log", "Server answers it is ready for step 21")
                                        ExitLoop


               ElseIf $WaitingTime>4000 Then
                                         _FileWriteLog($LogFolder&"info.log", "No Answer, we still continue" &$Data)
                                         ExitLoop
            EndIf




   WEnd
   _FileWriteLog($LogFolder&"info.log", "Left the WhileLoop")

 

 

And my logs show this:

 


2016-10-24 00:52:39 : Wait for answer that Server is ready for step 21


2016-10-24 00:52:39 : (Logline from completely different loop)

2016-10-24 00:52:39 : (Logline from completely different loop)

2016-10-24 00:52:39 : (Logline from completely different loop)

2016-10-24 00:52:39 : (Logline from completely different loop)

2016-10-24 00:52:40 : Wait for answer that Server is ready for step 21
2016-10-24 00:52:40 : Server answers it is ready for step 21

 

How can this happen? (If there was a "Left the Whileloop" log in between I could imagine it could happen... but now?

I thought AutoIT was singlethreaded...

 

 

 

 

 

  • Moderators
Posted

JohnNash,

AutoIt is single-threaded.

Do you have some form of _Timer_* or Adlib function running elsewhere in the script? That would allow the loop to be interrupted while still running.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted
  On 10/25/2016 at 7:51 AM, Melba23 said:

JohnNash,

AutoIt is single-threaded.

Do you have some form of _Timer_* or Adlib function running elsewhere in the script? That would allow the loop to be interrupted while still running.

M23

Expand  

Yes it seems indeed it has something to do with self-made sleep cycles (while ... wend). Also I ran multiple instances of the client by accident.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...