From: "Shot (Piotr Szotkowski)" Date: 2008-04-21T03:32:25+09:00 Subject: Re: [ANN] forkoff - parallel processing for ruby enumerables --pWyiEgJYm5f9v55/ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable ara howard: > forkoff works for any enumerable object, iterating a code > block to run in a child process and collecting the results. Thanks a lot for this great gem =E2=80=93 it=E2=80=99s a lifesaver for my PhD, which does some heavy computing in a parallelable way. A quick question, if I may. Assuming (which is not far from the truth) that I have no much knowledge on threads and processes, is there any way for the block under iteration to communicate with the outside world other than by the returned result? My example code: results =3D [] run =3D 0 runs =3D 2 ** fsm_inputs.size (0...runs).forkoff do |vector| results[vector] =3D by_input_sets vector # snip some run-based stats run +=3D 1 end This, obviously, doesn=E2=80=99t work (i.e., results is an empty array at t= he end and run is 0 in every iteration). I can get the results by making the block return the by_input_sets call=E2=80=99s result, but I still lose = the run-based stats. It seems a singleton-based approach would work (I=E2=80=99d create a single= ton object outside of the loop and have the results array and run counter be its properties), but maybe there is an easier way? -- Shot --=20 Added mysterious, undocumented --scanflags and --fuzzy options. -- nmap 3.0 announcement --pWyiEgJYm5f9v55/ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) iD8DBQFIC4yFi/mCfdEo8UoRAq4yAKDN+SVvve9d6Ln3QbK7APfTPtmkoACdH7B+ SsN1OCWhXdMD/XP6bkSl64g= =cm67 -----END PGP SIGNATURE----- --pWyiEgJYm5f9v55/--