Re: How to know when a multi-spawned process set finish its work?

Giovanni Giorgi <[email protected]>
Newsgroups gmane.comp.lang.erlang.general
Message-ID <[email protected]>
On 2021-04-13 10:55, Maria Scott wrote:
> Hi Giovanni,
> 
>> https://github.com/daitangio/er_zauker/blob/erlang-24-migration/src/er_zauker_app.erl
> 
> first, sorry, I have no idea what this actually does and how it does
> it ^^; I only skimmed the code. So what I'm saying here is a bit
> guesswork...
> From what I understand, you have a component that scans a tree on your
> file system and delivers file names. And you have another component
> that starts a process to index the files. Right?
...
> If I read it correctly, you don't wait until _every file_ has been
> _processed_. Instead, you wait until _a certain number of processes
> you are monitoring_ (not necessarily the ones you wait for, you only
> check if there _is_ a 'DOWN' message, not the monitor refs and/or
> pids) has _terminated_ (~line 100), _for whatever reason_ (you don't
> check the Reason for the termination). So some processes might have
> crashed and not done any work at all.
...
> and then a worker process may crash because it cannot open a file. But
> you don't notice because, see above. May that be it?

Yeah,
  thank you Maria, I think you are right.

So I suppose my entire code is not well written :(

Where can I find an example of a good code for this use case (even in 
the standard OTP library of course, I do not fear to read OTP code :) ?


-- 
Giovanni Giorgi via webmail
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.