Changeset 2518 for trunk/MagicSoft/Cosy/videodev
- Timestamp:
- 11/17/03 13:50:48 (21 years ago)
- Location:
- trunk/MagicSoft/Cosy/videodev
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/videodev/Camera.cc
r2278 r2518 1 1 #include "Camera.h" 2 2 3 #include <iostream.h> 4 #include <stdio.h> 5 #include <stdlib.h> 6 #include <errno.h> 7 #include <fcntl.h> 8 #include <string.h> 9 #include <signal.h> 10 #include <endian.h> 11 #include <sys/ioctl.h> 12 #include <sys/mman.h> 13 #include <sys/ipc.h> 14 #include <sys/shm.h> 3 #include <iostream> 4 #include <errno.h> // errono 5 #include <pthread.h> 6 #include <sys/ioctl.h> // ioctl 7 #include <sys/mman.h> // PROT_READ 15 8 16 9 #include "MStopwatch.h" … … 18 11 #include "videodev.h" 19 12 20 #include <sys/time.h>21 #include <sys/resource.h>22 23 13 ClassImp(Camera); 14 15 using namespace std; 24 16 25 17 inline int Camera::Ioctl(int req, void *opt, const char *str) … … 103 95 } 104 96 105 Camera::Camera(PixClient &client) : fd(-1), iBufferSize(0), fClient(client) 97 Camera::Camera(PixClient &client) : fd(-1), iBufferSize(0), fClient(client), fMutex(), fCond(&fMutex) 106 98 { 107 99 cout << "Starting thread..." << flush; 108 pthread_cond_init(&fCond, NULL); 109 pthread_mutex_init(&fMux, NULL); 110 pthread_mutex_lock(&fMux); 100 //pthread_cond_init(&fCond, NULL); 101 //pthread_mutex_init(&fMux, NULL); 102 //pthread_mutex_lock(&fMux); 103 fMutex.Lock(); 111 104 pthread_create(&fThread, NULL, MapThread, this); 112 105 cout << "done." << endl; … … 173 166 cout << "Stopping thread..." << flush; 174 167 pthread_cancel(fThread); 175 pthread_mutex_destroy(&fMux);176 pthread_cond_destroy(&fCond);168 //pthread_mutex_destroy(&fMux); 169 //pthread_cond_destroy(&fCond); 177 170 cout << "done." << endl; 178 171 … … 226 219 while (1) 227 220 { 228 pthread_cond_wait(&fCond, &fMux); 221 //pthread_cond_wait(&fCond, &fMux); 222 fCond.Wait(); 223 229 224 MStopwatch t; 230 225 t.Start(); … … 286 281 // set new number of frames to process 287 282 // 288 pthread_mutex_lock(&fMux); 283 fMutex.Lock(); 284 //pthread_mutex_lock(&fMux); 289 285 fNum = nof; 290 286 fStop = 0; 291 287 fRunning = 1; 292 pthread_mutex_unlock(&fMux); 288 fMutex.UnLock(); 289 //pthread_mutex_unlock(&fMux); 293 290 294 291 // 295 292 // Start execution 296 293 // 297 pthread_cond_signal(&fCond); 294 fCond.Broadcast(); 295 //pthread_cond_signal(&fCond); 298 296 } 299 297 -
trunk/MagicSoft/Cosy/videodev/Camera.h
r2278 r2518 2 2 #define CAMERA_H 3 3 4 #ifndef ROOT_TMutex 5 #include <TMutex.h> 6 #endif 7 #ifndef ROOT_TCondition 8 #include <TCondition.h> 9 #endif 10 4 11 #ifdef __CINT__ 5 12 typedef unsigned long int pthread_t; 6 struct pthread_mutex_t;7 struct pthread_cond_t;8 13 struct timeval; 9 14 #else 10 #include <TROOT.h>11 #include <pthread.h>12 15 #include <unistd.h> 13 16 #include <sys/time.h> … … 47 50 struct timeval fTime; 48 51 49 pthread_t fThread; 50 pthread_mutex_t fMux; 51 pthread_cond_t fCond; 52 PixClient &fClient; 52 53 53 PixClient &fClient; 54 pthread_t fThread; 55 TMutex fMutex; 56 TCondition fCond; 57 //pthread_mutex_t fMux; 58 //pthread_cond_t fCond; 54 59 55 60 //
Note:
See TracChangeset
for help on using the changeset viewer.