Distributed algorithms such as CSMA provide a popular mechanism for sharing the transmission medium among competing users in large-scale wireless networks. Conventional models for CSMA that are amenable for analysis assume that users always have packets to transmit. In contrast, when users do not compete for medium access when their buffers are empty, a complex interaction arises between the activity states and the buffer contents. We develop a meanfield approach to investigate this dynamic interaction for networks with many users. We identify a time-scale separation between the evolution of the activity states and the buffer contents, and obtain a deterministic dynamical system describing the network dynamics on a macroscopic scale. The fixed point of the dynamical system yields highly accurate approximations for the stationary distribution of the buffer contents and packet delay, even when the number of users is relatively moderate.