From def03ee25d3f2d76c0a21a65d72a1348d57faf2e Mon Sep 17 00:00:00 2001 From: pztrn Date: Fri, 7 Oct 2016 14:57:01 +0500 Subject: [PATCH] Lock thread to database, so it should not crash anymore. --- database/database_object.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/database/database_object.go b/database/database_object.go index 0c00efa..47b8f0a 100644 --- a/database/database_object.go +++ b/database/database_object.go @@ -14,6 +14,7 @@ import ( //"database/sql" "fmt" "path" + "runtime" "strconv" // local @@ -48,10 +49,12 @@ func (d *Database) Close() { tx.Commit() d.Db.Close() + runtime.UnlockOSThread() } func (d *Database) Initialize(cfg *configuration.Config) { fmt.Println("Initializing database...") + runtime.LockOSThread() // Connect to database. db_path := path.Join(cfg.TEMP["DATA"], "database.sqlite3")