danhen / php_threads
- Source
- Commits
- Network (1)
- Issues (0)
- Downloads (0)
- Wiki (2)
- Graphs
-
Branch:
master
| name | age | message | |
|---|---|---|---|
| |
README | Thu Jun 12 12:15:13 -0700 2008 | |
| |
bin/ | Mon Jul 14 09:09:36 -0700 2008 | |
| |
config.m4 | Wed Jun 11 11:55:01 -0700 2008 | |
| |
config.w32 | Wed Jun 11 11:55:01 -0700 2008 | |
| |
php_threads.h | Sat Jun 14 00:34:27 -0700 2008 | |
| |
tests/ | Sat Jun 14 00:31:37 -0700 2008 | |
| |
threadapi.c | Mon Jun 23 12:53:42 -0700 2008 | |
| |
threadapi.h | ||
| |
threads.c | ||
| |
threads.dsp | Wed Jun 11 11:42:30 -0700 2008 | |
| |
threads.dsw | Wed Jun 11 11:42:30 -0700 2008 |
README
This is highly experimental.
Run this only in CLI mode!
t
Example
master.php
<?php
$array = array(
0 => 'thread',
1 => 'hello',
2 => 'world');
thread_set('mySharedVar', $array);
thread_include('thread.php');
sleep(3);
echo 'Done';
?>
thread.php
<?php
$array = thread_get('mySharedVar');
print_r($array);
sleep(5);
echo 'Done';
?>
Do not load the extension with dl(). The thread-functions are working like normal SAPI calls
and creating a new context by calling php_startup_request(). Extensions loaded by dl() seems to be
bound to the calling request.
The example-code is working on WinXP (PHP-5.2.6 and 5.3) and Linux (Ubuntu 7.10/ PHP-5.2.6 GCC 4.1).
OS X 10 is getting evaluated currently but it seems to be unstable.

