Fix for linuxmint/Cinnamon#2803

This is my proposed fix for issue linuxmint/Cinnamon#2803. It depends on pull request linuxmint/Cinnamon#2805.

Notes:

- I'm not a regular contributor to this codebase or anything based on it. Therefore, it may need some more experienced attention to make it conform to coding style or standards used here.
- It involves multithreading. I simply couldn't think of a solution that doesn't involve concurrent processing, so multithreading it was. I don't have as much experience with multithreading as I'd like to, so please check it over to make sure it isn't prone to screwing up as multithreaded code tends to do.

Other than that, I hope this is acceptable. I've been running it since I wrote it yesterday, and it's worked fine. It completely fixes the problem. I don't *think* it has caused any lockups; Cinnamon on my machine does tend to lock up at random due to some unrelated issue (and has done since day 1), but it doesn't seem like this has made it any more frequent.