ALL > Computer and Education > courses > university courses > undergraduate courses > Operating System > CLASS (2016-2017-1)-62903-06102-1 > 2014329600026吴宪 >
project Version 0
👤 Author: by wuxian 2017-01-01 15:22:56

package question;

class ShareData{
//Use Char to represent the commodity
private char c;
//This variable is used to function as signal() in textbook.
private boolean putFlag = false;
//Use the reserved word synchronized to keep other process from run
//these following code when a process has entered into the putShareChar() method.
public synchronized void putShareChar(char c){
if(putFlag == true){
try{
wait();
}catch(InterruptedException e){}
}
this.c = c;
putFlag =

Please login to reply. Login

Reversion History

Loading...
No reversions found.