-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhanced code generation tools to support Python classes
- Loading branch information
Showing
26 changed files
with
630 additions
and
995 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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
require_once __DIR__ . '/../../vendor/autoload.php'; | ||
|
||
$thread_n = 4; | ||
$threads = []; | ||
|
||
$time = PyCore::import('time'); | ||
|
||
/** | ||
* !!! WARNING !!! | ||
* phpy does not support multithreading, | ||
* this program will crash | ||
*/ | ||
for ($i = 0; $i < $thread_n; $i++) { | ||
$thread = new python\threading\Thread(target: function () use ($i, $time) { | ||
$n = 10; | ||
while ($n--) { | ||
$time->sleep(1); | ||
echo "[Thread#{$i}]\thello world\n"; | ||
} | ||
}); | ||
$thread->start(); | ||
$threads[] = $thread; | ||
echo "Thread#{$i} is started\n"; | ||
} | ||
|
Oops, something went wrong.