From 7b8e8ab4299b2b35395b9c4d987a06203c56568f Mon Sep 17 00:00:00 2001 From: Joe Watkins Date: Fri, 4 Jan 2013 09:24:39 +0000 Subject: [PATCH] missing files from pthreads docs git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@328974 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/pthreads/stackable/lock.xml | 55 +++++++++ reference/pthreads/stackable/synchronized.xml | 108 ++++++++++++++++++ reference/pthreads/stackable/unlock.xml | 92 +++++++++++++++ reference/pthreads/thread/lock.xml | 86 ++++++++++++++ reference/pthreads/thread/synchronized.xml | 105 +++++++++++++++++ reference/pthreads/thread/unlock.xml | 86 ++++++++++++++ 6 files changed, 532 insertions(+) create mode 100644 reference/pthreads/stackable/lock.xml create mode 100644 reference/pthreads/stackable/synchronized.xml create mode 100644 reference/pthreads/stackable/unlock.xml create mode 100644 reference/pthreads/thread/lock.xml create mode 100644 reference/pthreads/thread/synchronized.xml create mode 100644 reference/pthreads/thread/unlock.xml diff --git a/reference/pthreads/stackable/lock.xml b/reference/pthreads/stackable/lock.xml new file mode 100644 index 0000000000..7291aa3256 --- /dev/null +++ b/reference/pthreads/stackable/lock.xml @@ -0,0 +1,55 @@ + + + + + + Stackable::lock + Synchronization + + + + &reftitle.description; + + final public booleanStackable::lock + + + + Lock the referenced objects storage for the calling context + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + A boolean indication of success + + + + + + + diff --git a/reference/pthreads/stackable/synchronized.xml b/reference/pthreads/stackable/synchronized.xml new file mode 100644 index 0000000000..37d376da1b --- /dev/null +++ b/reference/pthreads/stackable/synchronized.xml @@ -0,0 +1,108 @@ + + + + + + Stackable::synchronized + Synchronization + + + + &reftitle.description; + + final public mixedStackable::synchronized + Closureblock + mixed... + + + Executes the block while retaining the synchronization lock for the current context. + + + + + &reftitle.parameters; + + + block + + + The block of code to execute + + + + + ... + + + Variable length list of arguments to use as function arguments to the block + + + + + + + + &reftitle.returnvalues; + + The return value from the block + + + + + &reftitle.examples; + + + Synchronizing + +synchronized(function($object){ + var_dump($object->isWaiting()); + $object->notify(); + }, $this); + } +} +/** create worker **/ +$my = new My(); +/** stack my **/ +/** execute something here **/ +$my->synchronized(function($object){ + $object->wait(); +}, $my); +?> +]]> + + &example.outputs; + + + + + + + + + + diff --git a/reference/pthreads/stackable/unlock.xml b/reference/pthreads/stackable/unlock.xml new file mode 100644 index 0000000000..5bc152bef8 --- /dev/null +++ b/reference/pthreads/stackable/unlock.xml @@ -0,0 +1,92 @@ + + + + + + Stackable::unlock + Synchronization + + + + &reftitle.description; + + final public booleanStackable::unlock + + + + Unlock the referenced objects storage for the calling context + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + A boolean indication of success + + + + + &reftitle.examples; + + + Locking Object Storage + +lock()); + /** nobody can read or write **/ + var_dump($this->unlock()); + /** reading / writing resumed for all contexts */ + } +} +class My extends Worker { + public function run(){ + /** ... **/ + } +} +$my = new My(); +$work = array(new Work()); +$my->stack($work[0]); +$my->start(); +?> +]]> + + &example.outputs; + + + + + + + + + diff --git a/reference/pthreads/thread/lock.xml b/reference/pthreads/thread/lock.xml new file mode 100644 index 0000000000..a43b10ee90 --- /dev/null +++ b/reference/pthreads/thread/lock.xml @@ -0,0 +1,86 @@ + + + + + + Thread::lock + Synchronization + + + + &reftitle.description; + + final public booleanThread::lock + + + + Lock the referenced objects storage for the calling context + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + A boolean indication of success + + + + + &reftitle.examples; + + + Locking Thread Storage + +lock()); + /** nobody can read or write **/ + var_dump($this->unlock()); + /** reading / writing resumed for all other contexts */ + } +} +$my = new My(); +$my->start(); +?> +]]> + + &example.outputs; + + + + + + + + + + diff --git a/reference/pthreads/thread/synchronized.xml b/reference/pthreads/thread/synchronized.xml new file mode 100644 index 0000000000..bcbd53ff23 --- /dev/null +++ b/reference/pthreads/thread/synchronized.xml @@ -0,0 +1,105 @@ + + + + + + Thread::synchronized + Synchronization + + + + &reftitle.description; + + final public mixedThread::synchronized + Closureblock + mixed... + + + Executes the block while retaining the synchronization lock for the current context. + + + + + &reftitle.parameters; + + + block + + + The block of code to execute + + + + + ... + + + Variable length list of arguments to use as function arguments to the block + + + + + + + + &reftitle.returnvalues; + + The return value from the block + + + + + &reftitle.examples; + + + Synchronizing + +synchronized(function($thread){ + $thread->wait(); + }, $this); + } +} +$my = new My(); +$my->start(); +$my->synchronized(function($thread){ + $thread->notify(); +}, $my); +var_dump($my->join()); +?> +]]> + + &example.outputs; + + + + + + + + + diff --git a/reference/pthreads/thread/unlock.xml b/reference/pthreads/thread/unlock.xml new file mode 100644 index 0000000000..31e6006571 --- /dev/null +++ b/reference/pthreads/thread/unlock.xml @@ -0,0 +1,86 @@ + + + + + + Thread::unlock + Synchronization + + + + &reftitle.description; + + final public booleanThread::unlock + + + + Unlock the referenced objects storage for the calling context + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + A boolean indication of success + + + + + &reftitle.examples; + + + Locking Thread Storage + +lock()); + /** nobody can read or write **/ + var_dump($this->unlock()); + /** reading / writing resumed for all other contexts */ + } +} +$my = new My(); +$my->start(); +?> +]]> + + &example.outputs; + + + + + + + + + +