danhen / php_threads

multithreading extension for PHP

This URL has Read+Write access

name age message
file README Thu Jun 12 12:15:13 -0700 2008 README update [danhen]
directory bin/ Mon Jul 14 09:09:36 -0700 2008 Added Windows binaries [danhen]
file config.m4 Wed Jun 11 11:55:01 -0700 2008 First commit [danhen]
file config.w32 Wed Jun 11 11:55:01 -0700 2008 First commit [danhen]
file php_threads.h Sat Jun 14 00:34:27 -0700 2008 Merged indeyets changes [danhen]
directory tests/ Sat Jun 14 00:31:37 -0700 2008 Merged indeyets changes [danhen]
file threadapi.c Mon Jun 23 12:53:42 -0700 2008 Fixed most of the memleaks of the test script [danhen]
file threadapi.h Loading commit data...
file threads.c
file threads.dsp Wed Jun 11 11:42:30 -0700 2008 first commit [danhen]
file threads.dsw Wed Jun 11 11:42:30 -0700 2008 first commit [danhen]
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.