Page 119 - Nodejs 교과서 개정2판
P. 119

worker.on('error',	(err)	=>	{
           						throw	err;
           				});
           				worker.on('exit',	()	=>	{
           						threads.delete(worker);
           						if	(threads.size	===	0)	{
           								console.timeEnd('prime');
           								console.log(primes.length);
           						}
           				});
           				worker.on('message',	(msg)	=>	{
           						primes	=	primes.concat(msg);
           				});
           		}
           }	else	{
           		findPrimes(workerData.start,	workerData.range);
           		parentPort.postMessage(primes);
           }




         ৈؑ ѐ੄ झۨ٘о ੌਸ աׇࢲ ୊ܻೞѱ ೮णפ׮  ݣ౭ झۨ٬ਸ ೡ ٸח ੌਸ աׇࢲ ୊ܻೞب۾ ೞח ѱ ઁ
         ੌ য۵णפ׮  যځೠ ੌ਷ ҕਬೞҊ ੓ח ؘ੉ఠо ݆ই ੌਸ ա־ӝо য۵णפ׮  ׮೯൤ ࣗࣻ੄ ѐࣻܳ ҳ

         ೞח ੘স਷ ੿೧૓ ߧਤ  ࠗఠ      ݅ ܳ झٜۨ٘੉ ੌ੿ೞѱ աׇࢲ ࣻ೯ೡ ࣻ ੓णפ׮

          콘솔

           $	node	prime-worker
           prime:	1.752s
           664579




         ࣘبо ৈࢽ ߓ ੿ب ࡈۄ઎णפ׮  ਕழ झۨ٘ܳ ৈؑ ѐ ࢎਊ೮׮Ҋ ೧ࢲ ৈؑ ߓ ࡈۄ૑ח Ѫ਷ ইתפ׮  झ
         ۨ٘ܳ ࢤࢿೞҊ झۨ٘ ࢎ੉ীࢲ ాनೞח ؘ ࢚׼ೠ ࠺ਊ੉ ߊࢤೞ޲۽  ੉ ੼ਸ Ҋ۰೧ࢲ ݣ౭ झۨ٬ਸ ೧ঠ

         ೤פ׮  ੜޅೞݶ ݣ౭ झۨ٬ਸ ೡ ٸ यӖ झۨ٬ࠁ׮ ؊ ו۰૑ח അ࢚ب ߊࢤೡ ࣻ ੓णפ׮

         ׮਺ ੺ীࢲח ׮ܲ ೐۽ࣁझܳ ٜ݅য ੘সೞח ߑߨਸ ঌইࠁѷणפ׮

          
          
               DIJME@QSPDFTT

         ֢٘ীࢲ ׮ܲ ೐۽Ӓ۔ਸ प೯ೞҊ रѢա ݺ۸যܳ ࣻ೯ೞҊ रਸ ٸ ࢎਊೞח ݽٕੑפ׮  ੉ ݽٕਸ ా೧ ׮
         ܲ ঱য੄ ௏٘ ৘ܳ ٜݶ  ౵੉ॆ ܳ प೯ೞҊ ѾҞчਸ ߉ਸ ࣻ ੓णפ׮  ੉ܴ੉ DIJME@QSPDFTT ੗ध ೐۽ࣁ

         झ ੋ ੉ਬח അ੤ ֢٘ ೐۽ࣁझ ৻ী ࢜۽਍ ೐۽ࣁझܳ ڸਕࢲ ݺ۸ਸ ࣻ೯ೞҊ  ֢٘ ೐۽ࣁझী Ѿҗܳ ঌ
         ۰઱ӝ ٸޙੑפ׮
   114   115   116   117   118   119   120   121   122   123   124