Index: /trunk/ArchTOIPipe/Kernel/fitstoirdr.cc
===================================================================
--- /trunk/ArchTOIPipe/Kernel/fitstoirdr.cc	(revision 1709)
+++ /trunk/ArchTOIPipe/Kernel/fitstoirdr.cc	(revision 1710)
@@ -128,10 +128,10 @@
        << firstSn << endl;
 
-  fits_lock();
   for (int i=0; i<nrows; i++) {
     int anyNul;
     double y;
+    fits_lock();
     fits_read_col_dbl(fptr,1,i+1,1,1,0,&y,&anyNul,&fstatus);
-    //fits_unlock();
+    fits_unlock();
     int sn = (int) (y+.1);
     TOIManager* mgr = TOIManager::getManager();
@@ -142,5 +142,5 @@
       int j = colsinput[k].first;
       if ( !checkOutputTOIIndex(k) )  continue;  // Reza - Si TOI non connecte
-      //      fits_lock();
+      fits_lock();
       fits_read_col_dbl(fptr,j+1,i+1,1,1,0,&y,&anyNul,&fstatus);
       long flg = 0;
@@ -148,15 +148,15 @@
 	fits_read_col_lng(fptr,j+2,i+1,1,1,0,&flg,&anyNul,&fstatus);
       }
-      //      fits_unlock();
+      fits_unlock();
       putData(k, sn, y, flg);
     }
-    if (i%50==0)  {
+/*    if (i%50==0)  {
       fits_unlock();
       sched_yield();
       fits_lock();
-    }
+    }*/
     totnscount++;
   }
-  fits_unlock();
+  //fits_unlock();
   cout << "reader done reading... " << pthread_self() << endl;
 }
Index: /trunk/ArchTOIPipe/Kernel/toisegment.cc
===================================================================
--- /trunk/ArchTOIPipe/Kernel/toisegment.cc	(revision 1709)
+++ /trunk/ArchTOIPipe/Kernel/toisegment.cc	(revision 1710)
@@ -10,11 +10,11 @@
 static void cout_lock() {pthread_mutex_lock(&cout_mutex);}
 static void cout_unlock() {pthread_mutex_unlock(&cout_mutex);}
-#define LOG(_xxx_)
-/*
+//#define LOG(_xxx_)
+// /*
 #define LOG(_xxx_) \
 cout_lock(); \
 _xxx_; \
 cout_unlock();
-*/
+// */
 
 /******************************/
@@ -23,10 +23,10 @@
 
 TOISegmented::TOISegmented(int bufsz, int maxseg) {
-  master = new MasterView(bufsz, maxseg);
+  master = new MasterView(bufsz, maxseg, "");
   setName("TOISegmented");
 }
 
 TOISegmented::TOISegmented(string nm, int bufsz, int maxseg) {
-  master = new MasterView(bufsz, maxseg);
+  master = new MasterView(bufsz, maxseg, nm);
   setName(nm);
 }
@@ -34,5 +34,5 @@
 TOISegmented::TOISegmented(char* cnm, int bufsz, int maxseg) {
   string nm = cnm;
-  master = new MasterView(bufsz, maxseg);
+  master = new MasterView(bufsz, maxseg, nm);
   setName(nm);
 }
@@ -217,5 +217,6 @@
   if (sn0 < 0 ||
       sn >= sn0 + segmentSize*segments.size()) {
-    LOG(cout << "BufferView " << hex << this << dec << ": read fault for " << sn << endl)
+    LOG(cout << master->name << " BufferView " 
+	<< hex << this << dec << ": read fault for " << sn << endl)
     sync();
     pthread_mutex_lock(&(master->read_wait_mutex));
@@ -223,5 +224,5 @@
       wait(); // must be atomic with loop test
       pthread_mutex_unlock(&(master->read_wait_mutex));
-      LOG(cout << "BufferView " << hex << this << dec << ": waiting for " << sn << endl)
+      LOG(cout << master->name << " BufferView " << hex << this << dec << ": waiting for " << sn << endl)
       sync();
       pthread_mutex_lock(&(master->read_wait_mutex));
@@ -229,5 +230,5 @@
     pthread_mutex_unlock(&(master->read_wait_mutex));
 
-    LOG(cout << "BufferView " << hex << this << dec << ": resuming for " << sn 
+    LOG(cout << master->name << " BufferView " << hex << this << dec << ": resuming for " << sn 
 	<< " now data for " << sn0 << " - " << sn0 + segmentSize*segments.size() 
 	<< " in " << segments.size() << " segments " << endl)
@@ -259,5 +260,5 @@
 /*******************************/
 
-TOISegmented::MasterView::MasterView(int bufsz, int maxseg) {
+TOISegmented::MasterView::MasterView(int bufsz, int maxseg, string nm) {
   currentSegment = NULL;
   maxSegments    = maxseg;
@@ -265,4 +266,5 @@
   sn0            = -1;
   nConsumers = 0;
+  name = nm;
   
   pthread_mutex_init(&views_mutex, NULL);
@@ -296,5 +298,5 @@
 	sn >= currentSegment->sn0 &&
 	sn < currentSegment->sn0 + currentSegment->bufferSize)) {
-    LOG(cout << "MasterView::putData, need extend for " << sn << endl)
+    LOG(cout << name << " MasterView::putData, need extend for " << sn << endl)
     nextSegment();
   }
@@ -328,5 +330,5 @@
 void TOISegmented::MasterView::signalWrite() { /* reader thread */ /* views locked */
   if (waitingOnWrite) {
-    LOG(cout << "MasterView : signal for wait on write" << endl)
+    LOG(cout << name << " MasterView : signal for wait on write" << endl)
     pthread_cond_signal(&write_wait_condv); // only one thread can be sleeping
   }
@@ -362,9 +364,9 @@
 
 void TOISegmented::MasterView::waitForCleaning() { /* writer thread */ /* views locked */
-  LOG(cout << "MasterView : write wait for clean for " << sn0 << endl)
+  LOG(cout << name << " MasterView : write wait for clean for " << sn0 << endl)
   waitingOnWrite = true;
   checkDeadLock();
   pthread_cond_wait(&write_wait_condv, &views_mutex);
-  LOG(cout << "MasterView : wait done" << endl)
+  LOG(cout << name << " MasterView : wait done" << endl)
 }
 
@@ -403,5 +405,5 @@
     }
     
-    LOG(cout << "MasterView : firstNeeded = " << firstNeeded << endl);
+    LOG(cout << name << " MasterView : firstNeeded = " << firstNeeded << endl);
       
     vector<BufferSegment*>::iterator j = segments.begin();
@@ -447,5 +449,5 @@
   }
 
-  LOG(cout << "sync for " << hex << bv << dec << " : "
+  LOG(cout << name << " sync for " << hex << bv << dec << " : "
       << oldBegin << " - " << oldEnd << "  -->  "
       << bv->sn0 << " - " << newEnd << endl);
Index: /trunk/ArchTOIPipe/Kernel/toisegment.h
===================================================================
--- /trunk/ArchTOIPipe/Kernel/toisegment.h	(revision 1709)
+++ /trunk/ArchTOIPipe/Kernel/toisegment.h	(revision 1710)
@@ -101,5 +101,5 @@
   class MasterView {
   public:
-    MasterView(int bufsz=256, int maxseg=20);
+    MasterView(int bufsz=256, int maxseg=20, string nm="");
     ~MasterView();
 
@@ -114,4 +114,5 @@
     friend class BufferView;
     friend class TOISegmented;
+    string name;
     void signalWaitingViews(); // views are waiting on read
     void signalWrite();        // we are waiting on write
Index: /trunk/ArchTOIPipe/TestPipes/tstseg3.cc
===================================================================
--- /trunk/ArchTOIPipe/TestPipes/tstseg3.cc	(revision 1709)
+++ /trunk/ArchTOIPipe/TestPipes/tstseg3.cc	(revision 1710)
@@ -4,4 +4,5 @@
 #include "fitstoirdr.h"
 #include "fitstoiwtr.h"
+#include "asciitoiwtr.h"
 #include "toisqfilter.h"
 #include "toimanager.h"
@@ -16,5 +17,7 @@
 
   FITSTOIWriter w1("out1.fits");
-  FITSTOIWriter w2("out2.fits");
+//  FITSTOIWriter w2("out2.fits");
+ // ASCIITOIWriter w1("out1.data");
+ // ASCIITOIWriter w2("out2.data");
 
   
@@ -28,6 +31,6 @@
   w1.addInput("143K02", toi2);
 
-  w2.addInput("143K01", toi1);
-  w2.addInput("143K02", toi2);
+ // w2.addInput("143K01", toi1);
+ // w2.addInput("143K02", toi2);
   
   cout << "starting" << endl;
@@ -36,5 +39,5 @@
   r2.start();
   w1.start();
-  w2.start();
+  //w2.start();
 
   cout << "joining" << endl;
Index: /trunk/ArchTOIPipe/fan_copy
===================================================================
--- /trunk/ArchTOIPipe/fan_copy	(revision 1709)
+++ /trunk/ArchTOIPipe/fan_copy	(revision 1710)
@@ -6,6 +6,10 @@
   foreach f (`cat files_$d`)
    echo $f
-   cp -p $f $d/$f
+   rm -f $d/$f
+   ln -s ../$f $d/$f
+   #cp -p $f $d/$f
   end
-  cp -p Makefile.in_$d $d/Makefile.in
+  rm -f $d/Makefile.in
+  ln -s ../Makefile.in_$d $d/Makefile.in
+  #cp -p Makefile.in_$d $d/Makefile.in
 end
