Yes, you are right.
登录 | 论坛导航 -> 华新鲜事 -> 求学狮城 | 本帖共有 1 楼,分 1 页, 当前显示第 1 页 : 本帖树形列表 : 刷新 : 返回上一页
<<始页  [1]  末页>>
作者:Flying (等级:18 - 华新水车,发帖:16849) 发表:2003-11-20 22:20:49  楼主  关注此帖
关于java.long.Object.notify()Java API doc 对这个method有这么一段叙述: This method should only be called by a thread that is the owner of this object's monitor. A thread becomes the owner of the object's monitor in one of three ways: 1) By executing a synchronized instance method of that object. 2) By executing the body of a synchronized statement that synchronizes on the object. 3) For objects of type Class, by executing a synchronized static method of that class. --------------------------------------------------- 关于第二点, 请问它的意思是指可以在synchronized的method里面call notify()吗? 比如: class Buffer { private String[] buff = new String[8]; private boolean writable = true; private boolean readable = false; private int readloc = 0, writeloc = 0; synchronized void produce (String data) { while (!writable) { try { wait(); } catch (InterruptedException e) { (more...)
Yes, you are right.
Flying @way 吳穎暉
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版所有回复从这里展开收起列表
论坛导航 -> 华新鲜事 -> 求学狮城 | 返回上一页 | 本主题共有 1 篇文章,分 1 页, 当前显示第 1 页 | 回到顶部
<<始页  [1]  末页>>

请登录后回复:帐号   密码