Changeset 1727 for trunk/MagicSoft/Cosy/base
- Timestamp:
- 01/23/03 13:32:58 (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/base/msgqueue.cc
r1275 r1727 77 77 while(1) 78 78 { 79 while (!fStart) usleep(1); 79 while (!fStart) 80 usleep(1); 80 81 fStart = 0; 81 82 … … 88 89 pthread_mutex_unlock(&fMuxMsg); 89 90 90 cout << " Processing Msg 0x" << hex << fMsg << endl;91 cout << "MsgQueue::Thread: Processing Msg 0x" << hex << fMsg << endl; 91 92 // --- bool quit = fMsg==WM_QUIT; 92 93 fRc=Proc(fMsg, fMp); 93 cout << "Msg 0x" << hex << fMsg << " processed." << endl;94 cout << "MsgQueue::PostMsg: Msg 0x" << hex << fMsg << " processed (rc=" << fRc << ")" << endl; 94 95 95 96 // --- if (quit) … … 118 119 // stopped and the messages are processed serialized 119 120 // 120 cout << " Locking MsgQueue mutex..." << flush;121 cout << "MsgQueue::PostMsg: Locking MsgQueue mutex..." << flush; 121 122 pthread_mutex_lock(&fMuxMsg); 122 123 cout << "done." << endl; … … 129 130 // This is some kind of controlled user break without using signals 130 131 // 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; 131 141 fBreak = 1; 132 142 … … 146 156 // Start Proc() 147 157 // 158 cout << "MsgQueue::PostMsg: Releasing MsgQueue mutex..." << flush; 148 159 fStart = 1; 149 cout << "Releasing MsgQueue mutex..." << flush;150 160 pthread_mutex_unlock(&fMuxMsg); 151 161 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; 156 178 return rc; 157 179 } 158 180 /* 181 Start positioning. 182 MsgQueue::PostMsg: Locking MsgQueue mutex...done. 183 MsgQueue::PostMsg: ---> Break <--- 184 +++++ MsgQueue::PostMsg: Releasing MsgQueue mutex...done. 185 186 ===== MsgQueue::PostMsg: Returning rc = (nil) 187 PostMsg (WM_Position) returned. 188 done. 189 Stopping movement...Movement stopped. 190 WM_Position: done. (return 0x7777) 191 MsgQueue::PostMsg: Msg 0x1001 processed (rc=0x7777) 192 MsgQueue::Thread: Processing Msg 0x1001 193 WM_Position: start. 194 Positioning to Target... 195 */ 196 /* 197 Start positioning. 198 MsgQueue::PostMsg: Locking MsgQueue mutex...done. 199 MsgQueue::PostMsg: ---> Break <--- 200 +++++ MsgQueue::PostMsg: Releasing MsgQueue mutex...done. 201 202 done. 203 Stopping movement...Movement stopped. 204 WM_Position: done. (return 0x7777) 205 MsgQueue::PostMsg: Msg 0x1001 processed (rc=0x7777) 206 MsgQueue::Thread: Processing Msg 0x1001 207 WM_Position: start. 208 Positioning to Target... 209 ===== MsgQueue::PostMsg: Returning rc = (nil) 210 */
Note:
See TracChangeset
for help on using the changeset viewer.