Index: trunk/MagicSoft/Cosy/videodev/Camera.cc
===================================================================
--- trunk/MagicSoft/Cosy/videodev/Camera.cc	(revision 2278)
+++ trunk/MagicSoft/Cosy/videodev/Camera.cc	(revision 2518)
@@ -1,16 +1,9 @@
 #include "Camera.h"
 
-#include <iostream.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <string.h>
-#include <signal.h>
-#include <endian.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
+#include <iostream>
+#include <errno.h>     // errono
+#include <pthread.h>
+#include <sys/ioctl.h> // ioctl
+#include <sys/mman.h>  // PROT_READ
 
 #include "MStopwatch.h"
@@ -18,8 +11,7 @@
 #include "videodev.h"
 
-#include <sys/time.h>
-#include <sys/resource.h>
-
 ClassImp(Camera);
+
+using namespace std;
 
 inline int Camera::Ioctl(int req, void *opt, const char *str)
@@ -103,10 +95,11 @@
 }
 
-Camera::Camera(PixClient &client) : fd(-1), iBufferSize(0), fClient(client)
+Camera::Camera(PixClient &client) : fd(-1), iBufferSize(0), fClient(client), fMutex(), fCond(&fMutex)
 {
     cout << "Starting thread..." << flush;
-    pthread_cond_init(&fCond, NULL);
-    pthread_mutex_init(&fMux, NULL);
-    pthread_mutex_lock(&fMux);
+    //pthread_cond_init(&fCond, NULL);
+    //pthread_mutex_init(&fMux, NULL);
+    //pthread_mutex_lock(&fMux);
+    fMutex.Lock();
     pthread_create(&fThread, NULL, MapThread, this);
     cout << "done." << endl;
@@ -173,6 +166,6 @@
     cout << "Stopping thread..." << flush;
     pthread_cancel(fThread);
-    pthread_mutex_destroy(&fMux);
-    pthread_cond_destroy(&fCond);
+    //pthread_mutex_destroy(&fMux);
+    //pthread_cond_destroy(&fCond);
     cout << "done." << endl;
 
@@ -226,5 +219,7 @@
     while (1)
     {
-        pthread_cond_wait(&fCond, &fMux);
+        //pthread_cond_wait(&fCond, &fMux);
+        fCond.Wait();
+
         MStopwatch t;
         t.Start();
@@ -286,14 +281,17 @@
     // set new number of frames to process
     //
-    pthread_mutex_lock(&fMux);
+    fMutex.Lock();
+    //pthread_mutex_lock(&fMux);
     fNum     = nof;
     fStop    = 0;
     fRunning = 1;
-    pthread_mutex_unlock(&fMux);
+    fMutex.UnLock();
+    //pthread_mutex_unlock(&fMux);
 
     //
     // Start execution
     //
-    pthread_cond_signal(&fCond);
+    fCond.Broadcast();
+    //pthread_cond_signal(&fCond);
 }
 
Index: trunk/MagicSoft/Cosy/videodev/Camera.h
===================================================================
--- trunk/MagicSoft/Cosy/videodev/Camera.h	(revision 2278)
+++ trunk/MagicSoft/Cosy/videodev/Camera.h	(revision 2518)
@@ -2,12 +2,15 @@
 #define CAMERA_H
 
+#ifndef ROOT_TMutex
+#include <TMutex.h>
+#endif
+#ifndef ROOT_TCondition
+#include <TCondition.h>
+#endif
+
 #ifdef __CINT__
 typedef unsigned long int pthread_t;
-struct pthread_mutex_t;
-struct pthread_cond_t;
 struct timeval;
 #else
-#include <TROOT.h>
-#include <pthread.h>
 #include <unistd.h>
 #include <sys/time.h>
@@ -47,9 +50,11 @@
     struct timeval fTime;
 
-    pthread_t       fThread;
-    pthread_mutex_t fMux;
-    pthread_cond_t  fCond;
+    PixClient &fClient;
 
-    PixClient &fClient;
+    pthread_t  fThread;
+    TMutex     fMutex;
+    TCondition fCond;
+    //pthread_mutex_t fMux;
+    //pthread_cond_t  fCond;
 
     //
