@vimap.util.instancemethod_runonce()
    def close(self):
        finalize_methods = []

        def _wait_close(queue_name, pipe_name, pipe):
            """Works around bugs (or misuse?) in multiprocessing.queue by waiting for
            a queue's internal pipes to actually be closed.

            See https://github.com/gatoatigrado/vimap/issues/14 for more information.
            """
            if not pipe.closed:
                if self.debug:
                    print("Force-closing {0} pipe for queue {1}".format(pipe_name, queue_name))
                pipe.close()

        def _close_queue(name, queue):
            if self.debug:
                print("Main thread queue manager: Closing and joining {0} queue".format(name))
            queue.close()
            queue.join_thread()

            # NOTE: If we're using a different queue (e.g. our mock SerialQueue),
            # or using a different implementation of Python, don't do this fragile
            # mock.
            if hasattr(queue, '_reader') and hasattr(queue, '_writer'):
                reader_pipe, writer_pipe = queue._reader, queue._writer
                finalize_methods.append(lambda: _wait_close(name, 'reader', reader_pipe))
                finalize_methods.append(lambda: _wait_close(name, 'writer', writer_pipe))

        _close_queue('input', self.input_queue)
        del self.input_queue  # Make future accesses fail

        assert self.output_queue.empty(), (
            "You should *not* close the output queue before it's all "
            "consumed, else any workers putting items into the queuewill hang!")
        _close_queue('output', self.output_queue)
        del self.output_queue  # Make future accesses fail

        for finalize_method in finalize_methods:
            finalize_method()
test binding in a timestamp
dataset/ETHPy150Open gatoatigrado/vimap/vimap/queue_manager.py/VimapQueueManager.close--crossover with--dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/cx_Oracle-5.1.2/test/TimestampVar.py/TestTimestampVar.testBindTimestamp