Phase 1 Language Basics + Advanced _1-3-Java language senior _05- abnormal and multi-threaded _ Section 4 wait waiting wake wake-up mechanism _8_ mechanism code that implements _ buns class & Baozi Pu category

Create a class buns



Bao Zipu


defined buns member variable, generated with parameters constructor buns

succession Thread thread class. Override the run method. Ensure that only one in execution, so the use synchronization

wait to try catch

the outer layer defined variables, the number indicating the production of buns

produce a good wake-up buns


plus a while loop

 

Guess you like

Origin www.cnblogs.com/wangjunwei/p/11261397.html