The previous code was broken in multiple ways. Mostly:
- Per-thread connections weren't flushed after deleting the tables, which could result in database is locked errors
- Background jobs were asked to pause, but we didn't wait for the pause to be effective, which was likely to cause the background jobs to access some removed tables.
Since this requires locking when accessing the idle states, refactoring the external VLC instance was necessary in order to drop some locks when replacing the instance (not doing so would systematically lead to a deadlock when stopping the background jobs as the lock was held in
setExternalLibvlcInstance while stopping the discoverer, and the discoverer would attempt to lock the same mutex to toggle its idle state)
Fix #405 (closed)
This will need to be backported