Implemented thread guard and added macros for it.