/**
* @tests java.io.PipedWriter#write(char[],int,int)
*/
public void test_write_$CII_MultiThread() throws Exception {
final PipedReader pr = new PipedReader();
final PipedWriter pw = new PipedWriter();
// test if writer recognizes dead reader
pr.connect(pw);
class WriteRunnable implements Runnable {
boolean pass = false;
volatile boolean readerAlive = true;
public void run() {
try {
pw.write(1);
while (readerAlive) {
// wait the reader thread dead
}
try {
// should throw exception since reader thread
// is now dead
char[] buf = new char[10];
pw.write(buf, 0, 10);
} catch (IOException e) {
pass = true;
}
} catch (IOException e) {
//ignore