Comments? Would this make anyone happy? =)
This would allow a non-related SMS to be reset when that particular
SMS is reset.
I wonder what would happen if the thread SMS is destroyed and the
cleanup is not unregistered. Hmm, that could be a problem.
The idea is important though. I can work on the details if we
agree this is the way to go. -- justin
Index: include/apr_sms.h
===================================================================
RCS file: /home/cvs/apr/include/apr_sms.h,v
retrieving revision 1.38
diff -u -r1.38 apr_sms.h
--- include/apr_sms.h 2001/07/11 17:00:00 1.38
+++ include/apr_sms.h 2001/07/18 00:41:27
@@ -332,6 +332,14 @@
apr_status_t
(*cleanup_fn)(void *));
/**
+ * Register a SMS to be cleaned up when we are reset or destroyed
+ * @param pms The parent SMS to register the cleanup function with
+ * @param cms The child SMS to destroy
+ */
+APR_DECLARE(apr_status_t) apr_sms_cleanup_register_reset(apr_sms_t *pms,
+ apr_sms_t *cms);
+
+/**
* Unregister a previously registered cleanup function
* @param sms The memory system the cleanup function is registered
* with
Index: memory/unix/apr_sms.c
===================================================================
RCS file: /home/cvs/apr/memory/unix/apr_sms.c,v
retrieving revision 1.48
diff -u -r1.48 apr_sms.c
--- memory/unix/apr_sms.c 2001/07/11 14:20:02 1.48
+++ memory/unix/apr_sms.c 2001/07/18 00:41:35
@@ -722,6 +722,13 @@
return APR_SUCCESS;
}
+APR_DECLARE(apr_status_t) apr_sms_cleanup_register_reset(apr_sms_t *pms,
+ apr_sms_t *cms)
+{
+ return apr_sms_cleanup_register(pms, APR_ALL_CLEANUPS, cms,
+ apr_sms_reset);
+}
+
APR_DECLARE(apr_status_t) apr_sms_cleanup_unregister(apr_sms_t *sms,
apr_int32_t type,
const void *data,