Ignore:
Timestamp:
11/17/03 13:50:48 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Cosy/videodev
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Cosy/videodev/Camera.cc

    r2278 r2518  
    11#include "Camera.h"
    22
    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
    158
    169#include "MStopwatch.h"
     
    1811#include "videodev.h"
    1912
    20 #include <sys/time.h>
    21 #include <sys/resource.h>
    22 
    2313ClassImp(Camera);
     14
     15using namespace std;
    2416
    2517inline int Camera::Ioctl(int req, void *opt, const char *str)
     
    10395}
    10496
    105 Camera::Camera(PixClient &client) : fd(-1), iBufferSize(0), fClient(client)
     97Camera::Camera(PixClient &client) : fd(-1), iBufferSize(0), fClient(client), fMutex(), fCond(&fMutex)
    10698{
    10799    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();
    111104    pthread_create(&fThread, NULL, MapThread, this);
    112105    cout << "done." << endl;
     
    173166    cout << "Stopping thread..." << flush;
    174167    pthread_cancel(fThread);
    175     pthread_mutex_destroy(&fMux);
    176     pthread_cond_destroy(&fCond);
     168    //pthread_mutex_destroy(&fMux);
     169    //pthread_cond_destroy(&fCond);
    177170    cout << "done." << endl;
    178171
     
    226219    while (1)
    227220    {
    228         pthread_cond_wait(&fCond, &fMux);
     221        //pthread_cond_wait(&fCond, &fMux);
     222        fCond.Wait();
     223
    229224        MStopwatch t;
    230225        t.Start();
     
    286281    // set new number of frames to process
    287282    //
    288     pthread_mutex_lock(&fMux);
     283    fMutex.Lock();
     284    //pthread_mutex_lock(&fMux);
    289285    fNum     = nof;
    290286    fStop    = 0;
    291287    fRunning = 1;
    292     pthread_mutex_unlock(&fMux);
     288    fMutex.UnLock();
     289    //pthread_mutex_unlock(&fMux);
    293290
    294291    //
    295292    // Start execution
    296293    //
    297     pthread_cond_signal(&fCond);
     294    fCond.Broadcast();
     295    //pthread_cond_signal(&fCond);
    298296}
    299297
  • trunk/MagicSoft/Cosy/videodev/Camera.h

    r2278 r2518  
    22#define CAMERA_H
    33
     4#ifndef ROOT_TMutex
     5#include <TMutex.h>
     6#endif
     7#ifndef ROOT_TCondition
     8#include <TCondition.h>
     9#endif
     10
    411#ifdef __CINT__
    512typedef unsigned long int pthread_t;
    6 struct pthread_mutex_t;
    7 struct pthread_cond_t;
    813struct timeval;
    914#else
    10 #include <TROOT.h>
    11 #include <pthread.h>
    1215#include <unistd.h>
    1316#include <sys/time.h>
     
    4750    struct timeval fTime;
    4851
    49     pthread_t       fThread;
    50     pthread_mutex_t fMux;
    51     pthread_cond_t  fCond;
     52    PixClient &fClient;
    5253
    53     PixClient &fClient;
     54    pthread_t  fThread;
     55    TMutex     fMutex;
     56    TCondition fCond;
     57    //pthread_mutex_t fMux;
     58    //pthread_cond_t  fCond;
    5459
    5560    //
Note: See TracChangeset for help on using the changeset viewer.