In-situ synchrotron X-ray diffraction (XRD) was used to monitor the thermal decomposition (thermolysis) of Cd thiolates precursors embedded in a polymer matrix and the nucleation of CdS nanoparticles. A thiolate precursor/polymer solid foil was heated to 300 degrees C in the X-ray diffraction setup of beamline W1.1 at Hasylab, and the diffraction curves were each recorded at 10 degrees C. At temperatures above 240 degrees C, the precursor decomposition is complete and CdS nanoparticles grow within the polymer matrix forming a nanocomposite with interesting optical properties. The nanoparticle structural properties (size and crystal structure) depend on the annealing temperature. Transmission electron microscopy (TEM) and photoluminescence (PL) analyses were used to characterize the nanoparticles. A possible mechanism driving the structural transformation of the precursor is inferred from the diffraction features arising at the different temperatures.