markevans/dragonfly — pull request #240 by cheald (2012-12-17 21:52:53+00:00)
Title: Thread safety

I've taken a crack at adding thread safety. I did have a couple of support commits before that:

* Updated jeweler's version to be compatible with modern versions of bundler
* Updated the Mongo dependency to 1.8 and updated to the new MongoClient usage semantics which debuted in 1.8

For the thread safety, I did the following:

* Dragonfly::App now memoizes on Thread.current, so a new app instance will be created and configured per thread. This should solve the majority of the thread synchronization issues.
* I added Monitor locks for various class instance variable usage in the model extensions. I think that I got them all, but review would be appreciated.

The tests pass, but I haven't had a chance to stress test this for thread leaks yet. However, it should be a start.