Synchronizing instance_writer for Class#class_attribute

@printercu and @dwbutler for review

Making `Class#class_attribute` thread-safe. Tested with MRI and JRuby 1.7.13.

Fixes #14021