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

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Cosy/base/MTimeout.cc

    r911 r2518  
    11#include "MTimeout.h"
     2
     3#include <TSystem.h>
     4
     5MTimeout::MTimeout(unsigned long ms=500) : fTimeout((ULong_t)gSystem->Now()+ms)
     6{
     7    // Use SetTime to change the timing
     8    // if (ms) TurnOn(); // Add to system list
     9}
     10
     11bool MTimeout::HasTimedOut()
     12{
     13    return fTimeout<(ULong_t)gSystem->Now();
     14}
     15
     16void MTimeout::Start(unsigned long ms=500)
     17{
     18    fTimeout = (ULong_t)gSystem->Now()+ms;
     19    //Reset();  // reset before adding
     20    //TurnOn(); // Add to system list
     21}
  • trunk/MagicSoft/Cosy/base/MTimeout.h

    r1702 r2518  
    1 #ifndef MTIMEOUT_H
    2 #define MTIMEOUT_H
     1#ifndef COSY_MTimeout
     2#define COSY_MTimeout
    33
    4 #include <TTimer.h>
     4//#include <TTimer.h>
    55
    6 class MTimeout : public TTimer
     6class MTimeout// : public TTimer
    77{
     8    /*
    89    Bool_t Notify()
    910    {
     
    1112        return kFALSE;
    1213    }
     14     */
     15    unsigned long fTimeout;
    1316
    1417public:
    15     MTimeout(Long_t ms=500) : TTimer(ms, kFALSE)
    16     {
    17         // Use SetTime to change the timing
    18         if (ms) TurnOn(); // Add to system list
    19     }
     18    MTimeout(unsigned long ms=500);
    2019
    21     void Start()
    22     {
    23         Reset();  // reset before adding
    24         TurnOn(); // Add to system list
    25     }
     20    bool HasTimedOut();
     21
     22    void Start(unsigned long ms=500);
    2623};
    2724
  • trunk/MagicSoft/Cosy/base/msgqueue.cc

    r1953 r2518  
    8989        // a PostMsg is processed correctly
    9090        //
    91         pthread_mutex_lock(&fMuxMsg);
     91        fMuxMsg.Lock();
    9292        fBreak = 0;
    93         pthread_mutex_unlock(&fMuxMsg);
     93        fMuxMsg.UnLock();
    9494
    9595#ifdef DEBUG
     
    130130    cout << "MsgQueue::PostMsg: Locking MsgQueue mutex..." << flush;
    131131#endif
    132     pthread_mutex_lock(&fMuxMsg);
     132    fMuxMsg.Lock();
    133133#ifdef DEBUG
    134134    cout << "done." << endl;
     
    145145    if (fBreak)
    146146    {
    147         pthread_mutex_unlock(&fMuxMsg);
     147        fMuxMsg.UnLock();
    148148#ifdef DEBUG
    149149        cout << "------------> MsgQueue::PostMsg: Proc still pending... Message IGNORED." << endl;
     
    176176#endif
    177177    fStart = 1;
    178     pthread_mutex_unlock(&fMuxMsg);
     178    fMuxMsg.UnLock();
    179179#ifdef DEBUG
    180180    cout << "done." << endl;
  • trunk/MagicSoft/Cosy/base/msgqueue.h

    r1273 r2518  
    66#define WM_NULL 0x0000
    77#define WM_QUIT 0xffff
     8
     9#ifndef ROOT_TMutex
     10#include <TMutex.h>
     11#endif
    812
    913class MsgQueue
     
    1923    void *fRc;    // Proc return code
    2024
    21     pthread_t       fThread;
    22     pthread_mutex_t fMuxMsg;
    23     pthread_cond_t  fCondMsg;
    24     pthread_mutex_t fMuxRc;
    25     pthread_cond_t  fCondRc;
     25    pthread_t fThread;
     26    TMutex    fMuxMsg;
    2627
    2728    static void *MapThread(void *arg);
     
    3637
    3738    virtual void *Proc(int msg, void *mp1);
     39    void *Proc(int msg) { return Proc(msg, 0); }
    3840
    3941    void *PostMsg(int msg, void *mp1, int size);
     42    void *PostMsg(int msg) { return PostMsg(msg, 0, 0); }
    4043};
    4144
  • trunk/MagicSoft/Cosy/base/timer.cc

    r2278 r2518  
    136136const char *Timer::GetTimeStr()
    137137{
    138     sprintf(fDateStr, "%d/%02d/%02d %d:%02d:%02d.%06li",
     138    sprintf(fDateStr, "%2d/%02d/%02d %d:%02d:%02d.%06li",
    139139            fYea, fMon, fDay, fHor, fMin, fSec, (long)(1000000.0*fMs));
    140140
     
    146146    char text[256];
    147147
    148     sprintf(text, "%d/%02d/%02d %d:%02d:%02d.%01li",
     148    sprintf(text, "%2d/%02d/%02d %d:%02d:%02d.%01li",
    149149            t.fYea, t.fMon, t.fDay, t.fHor, t.fMin, t.fSec, (long)(10.0*t.fMs));
    150150
Note: See TracChangeset for help on using the changeset viewer.