amphp / parallel

An advanced parallelization library for PHP, enabling efficient multitasking, optimizing resource use, and application responsiveness through multiple CPU threads.
MIT License
779 stars 64 forks source link

Small improvements on examples #194

Closed thgs closed 9 months ago

thgs commented 9 months ago

Shows output like so now:

➜  parallel git:(7b53bad) ✗ php examples/context.php
Waiting 2 seconds to send start data...
Demonstrating how alive the parent is for the 1st time.
Demonstrating how alive the parent is for the 2nd time.
Received the following from parent: Start data
Sleeping for 3 seconds...
Demonstrating how alive the parent is for the 3rd time.
Demonstrating how alive the parent is for the 4th time.
Demonstrating how alive the parent is for the 5th time.
Received the following from child: Data sent from child.
Sleeping for 2 seconds...
Demonstrating how alive the parent is for the 6th time.
Demonstrating how alive the parent is for the 7th time.
Process ended with value 42!

➜  parallel git:(7b53bad) ✗ php examples/process.php                   
Waiting 2 seconds to send start data...
Demonstrating how alive the parent is for the 1st time.
Demonstrating how alive the parent is for the 2nd time.
Received the following from parent: Start data
Sleeping for 3 seconds...
Demonstrating how alive the parent is for the 3rd time.
Demonstrating how alive the parent is for the 4th time.
Demonstrating how alive the parent is for the 5th time.
Received the following from child: Data sent from child.
Sleeping for 2 seconds...
Demonstrating how alive the parent is for the 6th time.
Demonstrating how alive the parent is for the 7th time.
Process ended with value 42!
thgs commented 9 months ago

@trowski @kelunik

this https://github.com/amphp/parallel/pull/194/commits/62d2f81138cdadd709f21ad13916ce1af10d9f97 can also go away, but the comments point to the wrong filename 🤷‍♂️

trowski commented 9 months ago

Thanks @thgs!