Thermal synchrotron radiation and its Comptonization in compact X-ray sources