Attach/Detach Entities from any Thread

Made few changes allowing to safely attach/detach Entities from any Thread.

It uses synchronized blocks, so rendering routine may be a little slower.