| 155 | Cleanup handlers are not real Apache handlers, as there is no "cleanup" phase in Apache. It's actually a cleanup callback for the request pool. Fortunately, we can provide a structure that will be passed to the callback function, and that structure can contain information about the module that registered the function: |
| 156 | |
| 157 | {{{ |
| 158 | struct modparrot_cleanup_info { |
| 159 | int module_index; /* the HLL module that registered us */ |
| 160 | Parrot_PMC callback; /* callback subroutine */ |
| 161 | Parrot_PMC hll_data; /* a PMC to pass to the callback */ |
| 162 | union { /* internal stuff for mod_parrot */ |
| 163 | conn_rec *c; |
| 164 | request_rec *r; |
| 165 | } data; |
| 166 | }; |
| 167 | typedef struct modparrot_cleanup_info modparrot_cleanup_info; |
| 168 | }}} |
| 169 | |
| 170 | {{{module_index}}} lets us know which module registered us. {{{callback}}} is the Sub PMC that should be invoked, and {{{hll_data}}} is a PMC that should be passed to the callback. {{{modparrot_meta_request_cleanup}}} is a generic callback function that uses this data to set the module index and call the subroutine. |
| 171 | |