rw/src/Common/AutoFlushWr.i3


Copyright (C) 1994, Digital Equipment Corp.

INTERFACE AutoFlushWr;
Writers that are automatically flushed; useful for writing to terminals.

IMPORT Wr, Time;

TYPE
  T <: Public;
  Public = Wr.T OBJECT METHODS init (ch: Wr.T; p: Time.T := -1.0D0): T END;
After wr := NEW(T).init(ch), everything written to wr will be forwarded to ch (that is, target(wr) = target(ch)). Furthermore, wr will be flushed automatically by a background thread every p seconds (approximately). If p is less than 0, it defaults to a value that is reasonable for writing to terminals. The child ch must be unlocked when init is called. After ch has been passed to init, you must not operate on ch (except implicitly through wr). Flushing wr flushes ch; closing wr closes ch.

END AutoFlushWr.