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

make thread_guard and thread_safe work with var and function decls