Brightify/torch-old

Add possibility to create TorchFactory per thread.

TadeasKriz opened this issue · 1 comments

According to http://www.sqlite.org/isolation.html, SQLite should have built-in synchronization and we should be able to init multiple torch factories, one per thread. That way the synchronization will be dealt with in the SQLite itself and users won't have to worry about it.

Possibly there will be only one TorchFactory, but it should produce torch instances with database connections per thread, having the UI thread's connection open on initialization.

Question: Can we detect when a thread is killed? If so, we should close the connection when thread is killed. Otherwise we might do it that way that torch will open the connection right before the operation and close it right after the operation.