You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-commits@lucene.apache.org by ro...@apache.org on 2005/06/02 07:01:45 UTC
svn commit: r179509 - /incubator/lucene4c/trunk/src/index/writer.cxx
Author: rooneg
Date: Wed Jun 1 22:01:44 2005
New Revision: 179509
URL: http://svn.apache.org/viewcvs?rev=179509&view=rev
Log:
Cache the pool we used to allocate the writer, so we can kill the cleanup
and prevent it from being called twice when someone explicitly closes the
writer.
* src/index/writer.cxx
(lcn_index_writer_t): add pool member.
(index_writer_make_internal): stash the pool in the writer.
(lcn_index_writer_close): kill the cleanup, so it won't run twice.
Modified:
incubator/lucene4c/trunk/src/index/writer.cxx
Modified: incubator/lucene4c/trunk/src/index/writer.cxx
URL: http://svn.apache.org/viewcvs/incubator/lucene4c/trunk/src/index/writer.cxx?rev=179509&r1=179508&r2=179509&view=diff
==============================================================================
--- incubator/lucene4c/trunk/src/index/writer.cxx (original)
+++ incubator/lucene4c/trunk/src/index/writer.cxx Wed Jun 1 22:01:44 2005
@@ -31,6 +31,7 @@
struct lcn_index_writer_t {
IndexWriter *impl;
+ apr_pool_t *pool;
};
struct index_writer_make_baton {
@@ -71,6 +72,7 @@
(*iwcb->writer)->impl = new IndexWriter (path,
iwcb->analyzer->impl,
iwcb->create);
+ (*iwcb->writer)->pool = iwcb->pool;
apr_pool_cleanup_register (iwcb->pool, *iwcb->writer, run_close, NULL);
}
@@ -156,6 +158,8 @@
lcn_index_writer_t *writer = static_cast<lcn_index_writer_t *>(b);
writer->impl->close ();
+
+ apr_pool_cleanup_kill (writer->pool, writer, run_close);
}
lcn_error_t *