For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > March 2006 > Re: 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 Re: how to check for completion of all threads when mutiple threads are running
Maxim Yegorushkin

2006-03-30, 7:02 pm


star wrote:
> cat filelist.txt | while read filename
> do
> processa $filename
> done
>
>
> processb


why not:

processa ($cat filelist.txt)
processb

Where processa receives the lines from filelist.txt as char** agrv list
in int main(int argc, char** argv). After all threads in processa
complete processa returns and processb is executed than.

Jordan Abel

2006-03-30, 7:02 pm

On 2006-03-30, Maxim Yegorushkin <maxim.yegorushkin@gmail.com> wrote:
>
> star wrote:
>
> why not:
>
> processa ($cat filelist.txt)
> processb
>
> Where processa receives the lines from filelist.txt as char** agrv list


not quite. It receives the whitespace-separated tokens from filelist.txt
as the argv list. His version has processa executed once per line, and
it receives the whitespace-separated tokens from the given line on each
run, which is better, but still not perfect.

> in int main(int argc, char** argv). After all threads in processa
> complete processa returns and processb is executed than.
>

Sponsored Links







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

Copyright 2008 codecomments.com