Boards.ie uses cookies. By continuing to browse this site you are agreeing to our use of cookies. Click here to find out more x
Post Reply  
 
Thread Tools Search this Thread
29-07-2020, 12:03   #1
veryangryman
Registered User
 
veryangryman's Avatar
 
Join Date: Nov 2007
Posts: 4,634
Bash: Threading and waiting on results

So i know i can inside my script do

methoda &
methodb &
methodc &

But i want to wait until all 3 are done so that i can then check logs etc. I want to achieve this without losing the efficiency that threading provides.

How do i check that the calls are done without stopping and waiting in each case?
veryangryman is offline  
Advertisement
29-07-2020, 13:48   #2
Colonel Panic
Registered User
 
Join Date: Aug 2011
Posts: 1,380
Quote:
Originally Posted by veryangryman View Post
So i know i can inside my script do

methoda &
methodb &
methodc &

But i want to wait until all 3 are done so that i can then check logs etc. I want to achieve this without losing the efficiency that threading provides.

How do i check that the calls are done without stopping and waiting in each case?
You can call the wait command to wait on spawned sub processes.
Colonel Panic is offline  
Thanks from:
04-08-2020, 16:39   #3
L.Jenkins
Let's Do This!!!
 
L.Jenkins's Avatar
 
Join Date: May 2009
Posts: 18,007
Quote:
Originally Posted by Colonel Panic View Post
You can call the wait command to wait on spawned sub processes.

This would be correct. Simply append the end of the script with 'wait' minus the '' of course.
L.Jenkins is offline  
Post Reply

Quick Reply
Message:
Remove Text Formatting
Bold
Italic
Underline

Insert Image
Wrap [QUOTE] tags around selected text
 
Decrease Size
Increase Size
Please sign up or log in to join the discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Share Tweet