make thread_guard and thread_safe work with var and function decls
Merge pull request #3 from gartung/cms-v3.4

make thread_guard and thread_safe work with var and function decls