home *** CD-ROM | disk | FTP | other *** search
/ Practical Programming in Tcl & Tk (4th Edition) / TCLBOOK4.BIN / pc / exsource / 21_9.tcl < prev    next >
Text File  |  2003-04-16  |  285b  |  23 lines

  1. #
  2. # Example 21-9
  3. # A basic implementation of a logging thread.
  4. #
  5.  
  6. set logger [::thread::create {
  7.     proc OpenLog {file} {
  8.         global fid
  9.         set fid [open $file a]
  10.     }
  11.     proc CloseLog {} {
  12.         global fid
  13.         close $fid
  14.     }
  15.     proc AddLog {msg} {
  16.         global fid
  17.         puts $fid $msg
  18.     }
  19.     ::thread::wait
  20. }]
  21.  
  22.  
  23.