package cn.lnu.thread.info;
public class ProducerConsumerDemo {
/**
* �������ߣ�������������
* ���߳�ͨ��,ͬ��+�ȴ�/���ѻ���
* ͨ��ͬ�����Խ��û�����������ѵ����⣬
* ����ȴ����������������û�����ѵ����������������һ��������һ�������������
* ʹ���˵ȴ�/���ѻ��ƣ���������ͬ���У�����ͬ��ʹ���������û������
* wait()���÷����������̴߳��ڶ���״̬�����ҽ��߳���ʱ�洢���̳߳���
* notify()/notifyAll()//����ָ���̳߳��е�����һ���߳�/������ָ���̳߳��е������߳�
*
* ��Щ��������ʹ����ͬ���У���Ϊ���DZ��������������ͬ�����ϵ��߳�״̬��
* ��ʹ����д����ʱ�������ʾ���������ڵ�������ʾ��ʽ�ǣ� ������.wait() ������.notify() ������.notifyAll()
*
* ��ͬ����notify()�����ܻ�����ͬ����wait()
*/
public static void main(String[] args) {
//1��������Դ
Resource r=new Resource();
//2,����������������������
Producer p=new Producer(r);
Consumer c=new Consumer(r);
//3�������߳�
Thread t1=new Thread(p);
Thread t2=new Thread(c);
t1.start();
t2.start();
}
}