class_docstr: This thread takes care of writing history to the database, so that
  the UI isn't held up while that happens.
  
  It waits for the HistoryManager's save_flag to be set, then writes out
  the history cache. The main thread is responsible for setting the flag when
  the cache size reaches a defined threshold.
class_docstr_tok: ["This","thread","takes","care","of","writing","history","to","the","database",",","so","that","the","UI","is","n't","held","up","while","that","happens",".","It","waits","for","the","HistoryManager","'s","save_flag","to","be","set",",","then","writes","out","the","history","cache",".","The","main","thread","is","responsible","for","setting","the","flag","when","the","cache","size","reaches","a","defined","threshold","."]
code: def __init__(self, history_manager):
      super(HistorySavingThread, self).__init__(
          name="IPythonHistorySavingThread"
      )
      self.history_manager = history_manager
      self.enabled = history_manager.enabled
      atexit.register(self.stop)
  
imports: import atexit
  import datetime
  from pathlib import Path
  import re
  import sqlite3
  import threading
  from traitlets.config.configurable import LoggingConfigurable
  from decorator import decorator
  from IPython.utils.decorators import undoc
  from IPython.paths import locate_profile
  from traitlets import Any, Bool, Dict, Instance, Integer, List, Unicode, Union, TraitError, default, observe
label_desc: Use image node_id 1 to create a new HistorySavingThread object from inherited base classes: threading with example: obj = HistorySavingThread(history_manager)