Index: /trunk/ArchTOIPipe/Kernel/toi.h
===================================================================
--- /trunk/ArchTOIPipe/Kernel/toi.h	(revision 1992)
+++ /trunk/ArchTOIPipe/Kernel/toi.h	(revision 1993)
@@ -5,5 +5,5 @@
 //                               Christophe Magneville
 //                               Reza Ansari
-// $Id: toi.h,v 1.15 2001-11-14 14:49:05 aubourg Exp $
+// $Id: toi.h,v 1.16 2002-05-09 20:22:37 ansari Exp $
 
 #ifndef TOI_H
@@ -127,7 +127,7 @@
 
   //   ----- Rajouts Reza 12/3/2001
-  void wait() {pthread_cond_wait(&condv, &mutex);}
-  void signal() {pthread_cond_signal(&condv);}
-  void broadcast() {pthread_cond_broadcast(&condv);}
+  inline void wait() {pthread_cond_wait(&condv, &mutex);}
+  inline void signal() {pthread_cond_signal(&condv);}
+  inline void broadcast() {pthread_cond_broadcast(&condv);}
   inline void waitPut() 
     {fgwaitput=true; countwaitput++; pthread_cond_wait(&condv, &mutex);}
@@ -136,6 +136,6 @@
   inline bool isPutWaiting() const { return fgwaitput; }
   inline bool isGetWaiting() const { return fgwaitget; }
-  inline void signalPut() {fgsigput=true;}
-  inline void signalGet() {fgsigget=true;}
+  inline void signalPut() {fgsigput=true; }
+  inline void signalGet() {fgsigget=true; }
   inline void cleanWaitPut() { fgsigput = fgwaitput = false; }
   inline void cleanWaitGet() { fgsigget = fgwaitget = false; }
Index: /trunk/ArchTOIPipe/Kernel/toiseqbuff.cc
===================================================================
--- /trunk/ArchTOIPipe/Kernel/toiseqbuff.cc	(revision 1992)
+++ /trunk/ArchTOIPipe/Kernel/toiseqbuff.cc	(revision 1993)
@@ -3,5 +3,5 @@
 //                               Christophe Magneville
 //                               Reza Ansari
-// $Id: toiseqbuff.cc,v 1.12 2002-05-08 22:22:33 ansari Exp $
+// $Id: toiseqbuff.cc,v 1.13 2002-05-09 20:22:37 ansari Exp $
 
 #include "toiprocessor.h"
@@ -125,4 +125,5 @@
 
 void TOISeqBuffered::getData(int i, double & val, uint_8 & flg) {
+  lock();
   if (!started) { 
     cout << " TOISeqBuffered::getData() - waitGet() Waiting for start ... " << endl;
@@ -135,4 +136,5 @@
 	   << " i=" << i << " next_in= " << next_in 
 	   << " next_out=" << next_out << endl;
+    unlock();
     throw RangeCheckError("TOISeqBuffered::getData(i) : data deleted");
   }
@@ -158,6 +160,8 @@
 	   << " i=" << i << " next_in= " << next_in 
 	   << " next_out=" << next_out << endl;
-    signalPut(); broadcast();
-  }
+    signalPut(); 
+  }
+  unlock();
+  if (fgsigput)  signal();
   return;
 }
@@ -166,4 +170,5 @@
 void TOISeqBuffered::getData(int i, int n, double* data, uint_8* flg)
 {
+  lock();
   if (!started) { 
     cout << " TOISeqBuffered::getData(i,n ...) - waitGet() Waiting for start ... " << endl;
@@ -176,4 +181,5 @@
 	   << " i=" << i << " next_in= " << next_in 
 	   << " next_out=" << next_out << endl;
+    unlock();
     throw RangeCheckError("TOISeqBuffered::getData(i) : data deleted");
   }
@@ -200,9 +206,10 @@
 	     << " i=" << i << " next_in= " << next_in 
 	     << " next_out=" << next_out << endl;
-      signalPut(); broadcast();
-    }
-  }
-  return;
-  
+      signalPut(); 
+    }
+  }
+  unlock();
+  if (fgsigput)  signal();
+  return;  
 }
 
@@ -238,4 +245,5 @@
 
 void TOISeqBuffered::putData(int i, double value, uint_8 flag) {
+  lock();
   if (!started) {
     first_in = next_in = i;
@@ -250,4 +258,5 @@
 	     << " next_out=" << next_out << endl;
       string msg = "TOISeqBuffered::putData() : i!=next_in TOIname="  + getName();
+      unlock();
       throw RangeCheckError(msg);
     }
@@ -272,9 +281,14 @@
 	   << " i=" << i << " next_in= " << next_in 
 	   << " next_out=" << next_out << endl;
-    signalGet(); broadcast();
-  }
-}
-
-void TOISeqBuffered::putData(int i, int n, double const* val, uint_8 const* flg) {
+    signalGet(); 
+  }
+  unlock();
+  if (fgsigget)  signal();
+  return;
+}
+
+void TOISeqBuffered::putData(int i, int n, double const* val, uint_8 const* flg) 
+{
+  lock();
   if (!started) {
     first_in = next_in = i;
@@ -289,4 +303,5 @@
 	     << " next_out=" << next_out << endl;
       string msg = "TOISeqBuffered::putData() : i!=next_in TOIname="  + getName();
+      unlock();
       throw RangeCheckError(msg);
     }
@@ -314,6 +329,9 @@
 	   << " i=" << i << " next_in= " << next_in 
 	   << " next_out=" << next_out << endl;
-    signalGet(); broadcast();
-  }
+    signalGet(); 
+  }
+  unlock();
+  if (fgsigget)  signal();
+  return;
 }
 
