Thermal equilibrium in thermodynamics is used in two cases. The first is that of thermal equilibrium within a system for itself. The other case is that of a relation between the respective physical states of two bodies. Thermal equilibrium in a system for itself means that the temperature within the system is spatially and temporally uniform. Thermal equilibrium as a relation between the physical states of two bodies means that there is actual or implied thermal connection between them. Thermal equilibrium is concerned with the theory of temperature.
Heat can flow into or out of a closed system by way of thermal conduction or of thermal radiation to or from a thermal reservoir; when this process effects net transfer of heat, the system’s temperature can be changing. As the transfer of energy as heat continues, the system is not in thermal equilibrium.
When an isolated system is left long enough it will reach a state of thermal equilibrium in itself. The temperature will be uniform throughout but not necessarily a state of thermodynamic equilibrium if there is some structural barrier that can prevent some possible processes in the system from reaching equilibrium.