Handling background tasks version 1

pruning the finished tasks/bridges is synchronized. Adding a bridge is not.