How about writing this logic in an extension?  Because u can write your own 
RSHUTDOWN function to protect your data.

sorry for my poor english.

--
lanxiaolu

在 2014年11月20日,下午6:30,Johannes Schlüter <johan...@schlueters.de> 写道:

> Hi,
> 
> On Tue, 2014-11-18 at 18:08 +0400, Tigran Bayburtsyan wrote:
>> I need to execute PHP code in some thread of my application and continue
>> excecution in another. Is is possible to somehow get all global PHP core
>> hashtables from first thread and restore PHP from that point in another
>> thread using that hashtables with all generated variables and functions ?
> 
> PHP works request base. Meaning the idea is to have isolated
> shared-nothing requests.
> 
> PHP can run in two modes:
> 
>     1. In a global environment, or
>     2. in a threaded environment
> 
> this is controlled by enabling or disabling ZTS - zend thread safety /
> TSRM thread-safe resource manager. In the first case you have a global
> state running one "request" at a time, theoretically this single request
> context can be accessd by multiple threads while access has to be
> guarded by some mutex.
> In the second case you can have multiple requests which separate state.
> Each of those is bound to a (posix|windows) thread sharing a context in
> this mode between different threads can't be easily done and requires
> patching (in non-public code I once created worker threads owning the
> PHP request and different threads can signal there to bypass, but that's
> a mess).
> 
> The probably most simple SAPI using different threads is my pconn SAPI:
> https://github.com/johannes/pconn-sapi
> 
> Except for source we don't really have good documentation on all the
> details. So please try to go through different SAPIs and try to
> understand them. Specific questions are welcome on this list.
> 
> johannes
> 
> 
> 
> -- 
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

Reply via email to