Move the thread locking from the safedict to the resource pool.

Also, remove the safedict class, not needed anymore.
Add in the ordered dict queue code to the added resources dict.
Implement the acquire method and their associated tests.