remove blocker nonsense from org.ibex.io
authoradam <adam@megacz.com>
Thu, 5 Jul 2007 01:47:42 +0000 (01:47 +0000)
committeradam <adam@megacz.com>
Thu, 5 Jul 2007 01:47:42 +0000 (01:47 +0000)
darcs-hash:20070705014742-5007d-7f13df49b8d5a9b46d7b6511d06a72f4f205d020.gz

src/org/ibex/io/Duct.java [deleted file]
src/org/ibex/io/Stream.java

diff --git a/src/org/ibex/io/Duct.java b/src/org/ibex/io/Duct.java
deleted file mode 100644 (file)
index e69de29..0000000
index d4e0c06..1d03c20 100644 (file)
@@ -89,86 +89,51 @@ public class Stream {
     public static class Closed          extends StreamException  { public Closed(String s) { super(s); } }
 
 
-    private static Hashtable blocker = new Hashtable();
-    public static void kill(Thread thread) {
-        Stream block = (Stream)blocker.get(thread);
-        if (block == null) {
-            Log.warn(Stream.class, "thread " + thread + " is not blocked on a stream");
-        } else {
-            Log.warn(Stream.class, "asynchronously closing " + block);
-            block.close();
-        }
-    }
-
     public char   peekc()                          {
-        Stream old = (Stream)blocker.get(Thread.currentThread());
-        try {
-            blocker.put(Thread.currentThread(), this);
-            flush(); return in.getc(true);
-        } finally { if (old == null) blocker.remove(Thread.currentThread()); else blocker.put(Thread.currentThread(), old); }
+        flush();
+        return in.getc(true);
     }
     public char   getc()                           {
-        Stream old = (Stream)blocker.get(Thread.currentThread());
-        try {
-            blocker.put(Thread.currentThread(), this);
-            flush(); char ret = in.getc(false); log(ret); return ret;
-        } finally { if (old == null) blocker.remove(Thread.currentThread()); else blocker.put(Thread.currentThread(), old); }
+        flush();
+        char ret = in.getc(false);
+        log(ret);
+        return ret;
     }   
     public String readln()                         {
-        Stream old = (Stream)blocker.get(Thread.currentThread());
-        try {
-            blocker.put(Thread.currentThread(), this);
-            flush(); String s = in.readln(); log(s); log('\n'); return s;
-        } finally { if (old == null) blocker.remove(Thread.currentThread()); else blocker.put(Thread.currentThread(), old); }
+        flush();
+        String s = in.readln();
+        log(s);
+        log('\n');
+        return s;
     }
     
     public void   print(String s) {
-        Stream old = (Stream)blocker.get(Thread.currentThread());
-        try {
-            blocker.put(Thread.currentThread(), this);
-            logWrite(s);
-            out.write(s);
-            flush();
-        } finally { if (old == null) blocker.remove(Thread.currentThread()); else blocker.put(Thread.currentThread(), old); }
+        logWrite(s);
+        out.write(s);
+        flush();
     }
     public void   println(String s) {
-        Stream old = (Stream)blocker.get(Thread.currentThread());
-        try {
-            blocker.put(Thread.currentThread(), this);
-            logWrite(s);
-            logWrite(newLine);
-            out.write(s);
-            out.write(newLine);
-            flush();
-        } finally { if (old == null) blocker.remove(Thread.currentThread()); else blocker.put(Thread.currentThread(), old); }
+        logWrite(s);
+        logWrite(newLine);
+        out.write(s);
+        out.write(newLine);
+        flush();
     }
     public void   flush()                          {
-        Stream old = (Stream)blocker.get(Thread.currentThread());
-        try {
-            blocker.put(Thread.currentThread(), this);
-            if (out != null) try { out.w.flush(); } catch(IOException e) { ioe(e); }
-        } finally { if (old == null) blocker.remove(Thread.currentThread()); else blocker.put(Thread.currentThread(), old); }
+        if (out != null) try { out.w.flush(); } catch(IOException e) { ioe(e); }
     }
     public int    read(byte[] b, int off, int len) {
-        Stream old = (Stream)blocker.get(Thread.currentThread());
-        try {
-            blocker.put(Thread.currentThread(), this);
-            flush();
-            int ret = in.readBytes(b, off, len);
-            if (log != null) log("\n[read " + ret + " bytes of binary data ]\n");
-            nnl = false;
-            return ret;
-        } finally { if (old == null) blocker.remove(Thread.currentThread()); else blocker.put(Thread.currentThread(), old); }
+        flush();
+        int ret = in.readBytes(b, off, len);
+        if (log != null) log("\n[read " + ret + " bytes of binary data ]\n");
+        nnl = false;
+        return ret;
     }
     public int    read(char[] c, int off, int len) {
-        Stream old = (Stream)blocker.get(Thread.currentThread());
-        try {
-            blocker.put(Thread.currentThread(), this);
-            flush();
-            int ret = in.read(c, off, len);
-            if (log != null && ret != -1) log(new String(c, off, ret));
-            return ret;
-        } finally { if (old == null) blocker.remove(Thread.currentThread()); else blocker.put(Thread.currentThread(), old); }
+        flush();
+        int ret = in.read(c, off, len);
+        if (log != null && ret != -1) log(new String(c, off, ret));
+        return ret;
     }
 
     public void   unread(String s)                 { in.unread(s); }