Ignore:
Timestamp:
04/12/03 19:06:27 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Cosy/base
Files:
2 edited

Legend:

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

    r1275 r1953  
    55#include <pthread.h>
    66#include <sys/resource.h>  // PRIO_PROCESS
     7
     8#undef DEBUG
    79
    810// ----------------------------------------------------------------------
     
    1416MThread::MThread(bool start, int prio) : fIsRunning(false), fIsDetached(false), fThread(NULL), fReturn(NULL)
    1517{
     18#ifdef DEBUG
     19    cout << "MThread::MThread" << endl;
     20#endif
    1621    if (!start)
    1722        return;
     
    2934MThread::~MThread()
    3035{
     36#ifdef DEBUG
    3137    cout << "~MThread::MThread" << endl;
     38#endif
    3239    Stop();
    3340}
     
    122129void MThread::Stop()
    123130{
     131#ifdef DEBUG
    124132    cout << "MThread::Stop: fThread=" << fThread << ", fIsRunning=" << (int)fIsRunning << endl;
     133#endif
     134
    125135    if (!fThread || !fIsRunning)
    126136        return;
     
    128138    if (fIsDetached)
    129139    {
     140#ifdef DEBUG
    130141        cout << "Stopping detached thread..." << flush;
     142#endif
    131143        pthread_cancel(*fThread);
    132144        fIsRunning = false;
     
    134146    else
    135147    {
     148#ifdef DEBUG
    136149        cout << "Stopping thread..." << flush;
     150#endif
    137151        fStop = true;
    138152        pthread_join(*fThread, &fReturn);
    139153    }
     154#ifdef DEBUG
    140155    cout << "done." << endl;
     156#endif
    141157
    142158    delete fThread;
    143159    fThread = NULL;
    144160
     161#ifdef DEBUG
    145162    cout << "MThread::Stop() done." << endl;
     163#endif
    146164}
  • trunk/MagicSoft/Cosy/base/msgqueue.cc

    r1727 r1953  
    66#include <sys/resource.h>  // PRIO_PROCESS
    77
     8#undef DEBUG
     9
    810// --------------------------------------------------------------------------
    911//
     
    2224MsgQueue::~MsgQueue()
    2325{
     26#ifdef DEBUG
    2427    cout << "~MsgQueue::MsgQueue" << endl;
     28#endif
    2529    pthread_cancel(fThread);
    2630    delete (unsigned char*)fMp;
     
    8993        pthread_mutex_unlock(&fMuxMsg);
    9094
     95#ifdef DEBUG
    9196        cout << "MsgQueue::Thread: Processing Msg 0x" << hex << fMsg << endl;
     97#endif
    9298        // --- bool quit = fMsg==WM_QUIT;
    9399        fRc=Proc(fMsg, fMp);
     100#ifdef DEBUG
    94101        cout << "MsgQueue::PostMsg: Msg 0x" << hex << fMsg << " processed (rc=" << fRc << ")" << endl;
     102#endif
    95103
    96104        // --- if (quit)
     
    119127    // stopped and the messages are processed serialized
    120128    //
     129#ifdef DEBUG
    121130    cout << "MsgQueue::PostMsg: Locking MsgQueue mutex..." << flush;
     131#endif
    122132    pthread_mutex_lock(&fMuxMsg);
     133#ifdef DEBUG
    123134    cout << "done." << endl;
     135#endif
    124136
    125137    //
     
    134146    {
    135147        pthread_mutex_unlock(&fMuxMsg);
     148#ifdef DEBUG
    136149        cout << "------------> MsgQueue::PostMsg: Proc still pending... Message IGNORED." << endl;
     150#endif
    137151        return NULL;
    138152    }
    139153    /**** NEW 20/01/2003 ****/
     154#ifdef DEBUG
    140155    cout << "MsgQueue::PostMsg: ---> Break <---" << endl;
     156#endif
    141157    fBreak = 1;
    142158
     
    156172    // Start Proc()
    157173    //
     174#ifdef DEBUG
    158175    cout << "MsgQueue::PostMsg: Releasing MsgQueue mutex..." << flush;
     176#endif
    159177    fStart = 1;
    160178    pthread_mutex_unlock(&fMuxMsg);
     179#ifdef DEBUG
    161180    cout << "done." << endl;
     181#endif
    162182
    163183    /*
     
    175195    //    usleep(1);
    176196 
     197#ifdef DEBUG
    177198    cout << "MsgQueue::PostMsg: Returning rc = " << hex << rc << endl;
     199#endif
    178200    return rc;
    179201}
Note: See TracChangeset for help on using the changeset viewer.