MCPcopy
hub / github.com/DuGuQiuBai/Java / run

Method run

day24/code/day24_Thread/src/cn/itcast_01/MovieTicket.java:33–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31 // }
32
33 @Override
34 public void run() {
35 while (true) {
36 try {
37 // ����
38 lock.lock();
39
40 if (tickets > 0) {
41 try {
42 Thread.sleep(100);
43 } catch (InterruptedException e) {
44 e.printStackTrace();
45 }
46
47 System.out.println(Thread.currentThread().getName()
48 + "���ڳ��۵�" + (tickets--) + "��Ʊ");
49 }
50 } finally {
51 // �ͷ���
52 lock.unlock();
53 }
54 }
55 }
56}

Callers

nothing calls this directly

Calls 2

sleepMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected