From abfe11a93454251be192bfde59be4ed05bc099fe Mon Sep 17 00:00:00 2001 From: Gwynne Raskind Date: Mon, 20 Oct 2008 23:10:53 +0000 Subject: [PATCH] A bit more on globals, and beginnings of a module lifecycle git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@267581 c90b9560-bf6c-de11-be94-00142212c4b1 --- internals2/intro.xml | 4 +- internals2/structure/globals.xml | 40 +++++++++++++++++- internals2/structure/lifecycle.xml | 66 +++++++++++++++++++++++++++++- 3 files changed, 106 insertions(+), 4 deletions(-) diff --git a/internals2/intro.xml b/internals2/intro.xml index e56b936249..0b220c77af 100644 --- a/internals2/intro.xml +++ b/internals2/intro.xml @@ -1,7 +1,9 @@ - + + Extension globals @@ -174,6 +174,44 @@ ZEND_DECLARE_MODULE_GLOBALS(counter) more information. + + + So with all of that in mind, here is our new version of the + counter_get: + + + + The right way to store the basic counter interface's value + + + + + + + This is a correct implementation. It is not, however, a complete one. The + section explains why. + diff --git a/internals2/structure/lifecycle.xml b/internals2/structure/lifecycle.xml index c7499f3b6a..8ecdc19c0c 100644 --- a/internals2/structure/lifecycle.xml +++ b/internals2/structure/lifecycle.xml @@ -1,8 +1,70 @@ - + Life cycle of an extension - + + + A Zend extension goes through several phases during its lifetime. All of + these phases are opportunities for the developer to perform various + initialization, termination, or informational functions. The Zend API allows + for hooks into five separate phases of an extension's existence, apart from + calls by PHP functions. + + + + Loading, unloading, and requests + + + As the Zend engine runs, it processes one or more "requests" from its + client. In the traditional CGI implementation, this corresponds to one + execution of a process. However, many other implementations, most notably + the Apache module, can map many requests onto a single PHP process. A Zend + extension may thus see many requests in its lifetime. + + + + + Overview + + + + + In the Zend API, a module is loaded into memory only once when the + associated PHP process starts up. Each module recieves a call to the + "module initialization" function specified in its + zend_module structure as it is loaded. + + + + + + Whenever the associated PHP process starts to handle a request from its + client - i.e. whenever the PHP interpreter is told to start working - each + module receives a call to the "request initialization" function specified + in its zend_module structure. + + + + + + Whenever the associated PHP process is done handling a request, each + module receives a call to the "request termination" function specified in + its zend_module structure. + + + + + + A given module is unloaded from memory when its associated PHP process is + shut down in an orderly manner. The module receives a call to the "module + termination" function specified in its + zend_module structure at this time. + + + + + +