We investigate the thermodynamic properties of a toy model of glasses: a hard-core lattice gas with nearest neighbor interaction in one dimension. The time-evolution is Markovian, with nearest-neighbor and next-nearest neighbor hoppings, and the transition rates are assumed to satisfy detailed balance condition, but the system is non-ergodic below a glass temperature. Below this temperature, the system is in restricted thermal equilibrium, where both the number of sectors, and the number of accessible states within a sector grow exponentially with the size of the system. Using partition functions that sum only over dynamically accessible states within a sector, and then taking a quenched average over the sectors, we determine the exact equation of state of this system.