added `@gcd_threadsafe` macro to reduce boilerplate and the probability of errors