For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > March 2006 > how to check for completion of all threads when mutiple threads are running









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author how to check for completion of all threads when mutiple threads are running
star

2006-03-30, 7:02 pm


cat filelist.txt | while read filename
do
processa $filename
done


processb

filelist.txt contains a list of file which has to be given as input to
processa. By using while loop mutiple threads of processa is started.
and time for each thread of processa cannot be determined because it
varies with the filesize. once all the threads of processa gets
completed, processb has to be started. Now my question is how to
identify whether all the threads of processa has got completed or not.

Thanks in advance
star

Fred Kleinschmidt

2006-03-30, 7:02 pm


"star" <shanmugaster@gmail.com> wrote in message
news:1143734297.252403.238810@i39g2000cwa.googlegroups.com...
>
> cat filelist.txt | while read filename
> do
> processa $filename
> done
>
>
> processb
>
> filelist.txt contains a list of file which has to be given as input to
> processa. By using while loop mutiple threads of processa is started.
> and time for each thread of processa cannot be determined because it
> varies with the filesize. once all the threads of processa gets
> completed, processb has to be started. Now my question is how to
> identify whether all the threads of processa has got completed or not.
>
> Thanks in advance
> star
>


As written, you will not have multiple threads. processa will execute
for the first input, then when that ends it will execute for the second,
and so on.
Perhaps you want
processa $filename &
--
Fred L. Kleinschmidt
Boeing Associate Technical Fellow
Technical Architect, Software Reuse Project


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com