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

Giovanni Giorgi jj@REDACTED
Tue Apr 13 12:08:43 CEST 2021


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


More information about the erlang-questions mailing list