首页 > TAG信息列表 > TestThread3

8、线程休眠

8、线程休眠  每个对象都有一把锁,sleep不会释放锁; package com.testthread1; public class TestThread3 implements Runnable{ private int ticketNums = 10 ; @Override public void run() { while (true){ if (ticketNums==0){

3、并发问题

线程不安全 public class TestThread3 implements Runnable{ private int ticketNums = 10 ; @Override public void run() { while (true){ if (ticketNums==0){ break; } System.out.println(Threa