Ignore:
Timestamp:
01/23/03 13:32:58 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r1275 r1727  
    7777    while(1)
    7878    {
    79         while (!fStart) usleep(1);
     79        while (!fStart)
     80            usleep(1);
    8081        fStart = 0;
    8182
     
    8889        pthread_mutex_unlock(&fMuxMsg);
    8990
    90         cout << "Processing Msg 0x" << hex << fMsg << endl;
     91        cout << "MsgQueue::Thread: Processing Msg 0x" << hex << fMsg << endl;
    9192        // --- bool quit = fMsg==WM_QUIT;
    9293        fRc=Proc(fMsg, fMp);
    93         cout << "Msg 0x" << hex << fMsg << " processed." << endl;
     94        cout << "MsgQueue::PostMsg: Msg 0x" << hex << fMsg << " processed (rc=" << fRc << ")" << endl;
    9495
    9596        // --- if (quit)
     
    118119    // stopped and the messages are processed serialized
    119120    //
    120     cout << "Locking MsgQueue mutex..." << flush;
     121    cout << "MsgQueue::PostMsg: Locking MsgQueue mutex..." << flush;
    121122    pthread_mutex_lock(&fMuxMsg);
    122123    cout << "done." << endl;
     
    129130    // This is some kind of controlled user break without using signals
    130131    //
     132    /**** NEW 20/01/2003 ****/
     133    if (fBreak)
     134    {
     135        pthread_mutex_unlock(&fMuxMsg);
     136        cout << "------------> MsgQueue::PostMsg: Proc still pending... Message IGNORED." << endl;
     137        return NULL;
     138    }
     139    /**** NEW 20/01/2003 ****/
     140    cout << "MsgQueue::PostMsg: ---> Break <---" << endl;
    131141    fBreak = 1;
    132142
     
    146156    // Start Proc()
    147157    //
     158    cout << "MsgQueue::PostMsg: Releasing MsgQueue mutex..." << flush;
    148159    fStart = 1;
    149     cout << "Releasing MsgQueue mutex..." << flush;
    150160    pthread_mutex_unlock(&fMuxMsg);
    151161    cout << "done." << endl;
    152     while (fStart)
    153         usleep(1);
    154 
    155     cout << "Returning rc = 0x" << hex << rc << endl;
     162
     163    /*
     164     * **** NEW 20/01/2003 ***
     165     *
     166     * This can halt the main thread, because it is waiting until
     167     * Proc has finished its execution which can take a while
     168     *
     169     * A side effect is, because you don't wait for the end of
     170     * the execution of Proc, if a new message is posted fBreak
     171     * and fStart is set again, new values are copied to fMsg and
     172     * fMp (FIXME? Harmefull?) and the message is not processed at all.
     173     */
     174    //while (fStart)
     175    //    usleep(1);
     176 
     177    cout << "MsgQueue::PostMsg: Returning rc = " << hex << rc << endl;
    156178    return rc;
    157179}
    158 
     180/*
     181Start positioning.
     182MsgQueue::PostMsg: Locking MsgQueue mutex...done.
     183MsgQueue::PostMsg: ---> Break <---
     184+++++ MsgQueue::PostMsg: Releasing MsgQueue mutex...done.
     185
     186===== MsgQueue::PostMsg: Returning rc = (nil)
     187PostMsg (WM_Position) returned.
     188done.
     189Stopping movement...Movement stopped.
     190WM_Position: done. (return 0x7777)
     191MsgQueue::PostMsg: Msg 0x1001 processed (rc=0x7777)
     192MsgQueue::Thread: Processing Msg 0x1001
     193WM_Position: start.
     194Positioning to Target...
     195 */
     196/*
     197Start positioning.
     198MsgQueue::PostMsg: Locking MsgQueue mutex...done.
     199MsgQueue::PostMsg: ---> Break <---
     200+++++ MsgQueue::PostMsg: Releasing MsgQueue mutex...done.
     201
     202done.
     203Stopping movement...Movement stopped.
     204WM_Position: done. (return 0x7777)
     205MsgQueue::PostMsg: Msg 0x1001 processed (rc=0x7777)
     206MsgQueue::Thread: Processing Msg 0x1001
     207WM_Position: start.
     208Positioning to Target...
     209===== MsgQueue::PostMsg: Returning rc = (nil)
     210*/
Note: See TracChangeset for help on using the changeset viewer.