module SQLite3::ForkSafety
def discard # :nodoc:
def discard # :nodoc: warned = @suppress @databases.each do |db| next unless db.weakref_alive? unless db.closed? || db.readonly? unless warned # If you are here, you may want to read # https://github.com/sparklemotion/sqlite3-ruby/pull/558 warn("Writable sqlite database connection(s) were inherited from a forked process. " \ "This is unsafe and the connections are being closed to prevent possible data " \ "corruption. Please close writable sqlite database connections before forking.", uplevel: 0) warned = true end db.close end end @databases.clear end
def hook! # :nodoc:
def hook! # :nodoc: ::Process.singleton_class.prepend(CoreExt) end
def suppress_warnings!
def suppress_warnings! @suppress = true end
def track(database) # :nodoc:
def track(database) # :nodoc: @mutex.synchronize do @databases << WeakRef.new(database) end end