mutex when writing the rgb image from callback