-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update: stream::waitForxxable timeout supports float Update: Refactor parallel && for Windows compatibility Feat: Worker support metadata
- Loading branch information
Showing
32 changed files
with
979 additions
and
986 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ composer.lock | |
.php-cs-fixer.cache | ||
.phpunit.cache | ||
.phpunit.result.cache | ||
.cursor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/assets/ | ||
/docs/ | ||
/examples/ | ||
/tests/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* Copyright © 2024 cclilshy | ||
* Email: [email protected] | ||
* | ||
* This software is licensed under the MIT License. | ||
* For full license details, please visit: https://opensource.org/licenses/MIT | ||
* | ||
* By using this software, you agree to the terms of the license. | ||
* Contributions, suggestions, and feedback are always welcome! | ||
*/ | ||
|
||
use Ripple\Parallel\Parallel; | ||
|
||
use function Co\wait; | ||
|
||
include 'vendor/autoload.php'; | ||
|
||
$parallel = Parallel::getInstance(); | ||
$function = function ($input) { | ||
\sleep(1); | ||
return $input; | ||
}; | ||
|
||
$futures = []; | ||
for ($i = 0; $i < 100; $i++) { | ||
$futures[] = $future = $parallel->run($function, ['name']); | ||
} | ||
|
||
foreach ($futures as $future) { | ||
echo \microtime(true) , ':', $future->value() , \PHP_EOL; | ||
} | ||
|
||
wait(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.