TAIYUAN, China—The pressures threatening China's status as the world's factory floor have been laid bare by a riot this week at a factory that makes parts for Apple Inc. and other electronics companies, a clash that workers said was sparked by onerous security and repressive living conditions.

The consequences of a riot that erupted on Sunday in the Hon Hai Precision Industry Co. 's plant go far beyond the security of Apple's supply chain, which relies on armies of industrious and docile Chinese workers.

The riot raises questions about the sustainability of China's vaunted manufacturing machine. And it poses a challenge to the government that is struggling to satisfy the soaring expectations of a new generation of Chinese workers who came of age in an era of double-digit economic growth and are less willing than their parents to make personal sacrifices for their country.

Dozens of workers questioned on Wednesday said the rioting on Sunday, which caused 40 injuries and led to the mobilization of some 5,000 police, was in part the result of growing tensions as guards severely enforced strict rules on the campus.

One worker said a drunken fight between two workers sparked a violent attack from a number of security guards seeking to control the situation. The scene of the guards beating the workers led their friends to call others for help, and before long a full-blown confrontation between guards and workers had broken out.