Jump to content
UBot Underground

Any Way To Detect If All Threads Are Finished Before Proceeding?


Recommended Posts

Is there anyway to detect that all threads have finished before the main script continues?

I have a script that spawns 21 threads, two at a time, with a minute pause between each set of two (just so everything isn't launching at once).

loop while($table cell(&NEW,#a,0) != "") {
     loop(2) {
         MyLogin($table cell(&NEW,#a,0), $table cell(&NEW,#a,1), $table cell(&NEW,#a,2), $table cell(&NEW,#a,3), $table cell(&NEW,#a,4), $table cell(&NEW,#a,7))
         increment(#a)
     }
wait(60)
}

The problem I have is some threads take longer to complete than others and during testing I've seen the script start to move on to the next step in the process before all the threads had finished. Which is an issue because the next step needs data that is being retrieved from the threaded part.

Edited by Denethor
Link to post
Share on other sites

I added a variable to the script and track it myself, but it seems there should be a way in Ubot to track this.

It increments the variable in the loop that spawns the thread and then the last line of the defined thread is to decrement that same variable.

Then I added a new loop in my code that just waits until the variable =0 before continuing on.

Crude, but it works

Link to post
Share on other sites

I added a variable to the script and track it myself, but it seems there should be a way in Ubot to track this.

It increments the variable in the loop that spawns the thread and then the last line of the defined thread is to decrement that same variable.

Then I added a new loop in my code that just waits until the variable =0 before continuing on.

Crude, but it works

 

This is the way to do it - at least for now that is.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...