Changeset 14586
- Timestamp:
- 11/08/12 12:11:29 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cosy/candrv/sdolist.cc
r8838 r14586 1 1 #include "sdolist.h" 2 2 3 #include <iostream> 3 #include "MLog.h" 4 #include "MLogManip.h" 5 6 #include "MTime.h" 7 4 8 5 9 ClassImp(PendingSDO); … … 8 12 using namespace std; 9 13 14 #undef DEBUG 15 16 #ifdef DEBUG 17 #include <fstream> 18 static ofstream fout; 19 #endif 20 10 21 PendingSDOList::PendingSDOList() 11 22 { 23 #ifdef DEBUG 24 fout.open("sdolist.txt", ios::app); 25 fout.rdbuf()->pubsetbuf(0,0); 26 fout << hex; 27 #endif 28 12 29 fFirst = new PendingSDO; 13 30 fLast = fFirst; … … 18 35 DelAll(); 19 36 delete fFirst; 37 38 #ifdef DEBUG 39 fout.close(); 40 #endif 20 41 } 21 42 … … 23 44 { 24 45 if (fMux.Lock()==13) 25 cout << "PendingSDOList::DelAll - mutex is already locked by this thread" << endl; 46 gLog << err << MTime(-1) << " - PendingSDOList::DelAll - mutex is already locked by this thread" << endl; 47 48 #ifdef DEBUG 49 fout << MTime(-1) << " - DelAll" << endl; 50 #endif 26 51 27 52 PendingSDO *prev = fFirst; … … 39 64 40 65 if (fMux.UnLock()==13) 41 cout << "PendingSDOList::DelAll - tried to unlock mutex locked by other thread." << endl;66 gLog << err << MTime(-1) << " - PendingSDOList::DelAll - tried to unlock mutex locked by other thread." << endl; 42 67 } 43 68 … … 47 72 48 73 if (fMux.Lock()==13) 49 cout << "PendingSDOList::Add - mutex is already locked by this thread" << endl; 74 gLog << err << MTime(-1) << " - PendingSDOList::Add - mutex is already locked by this thread" << endl; 75 76 #ifdef DEBUG 77 fout << MTime(-1) << " - Add " << idx << "/" << subidx << " @ " << node << endl; 78 #endif 79 50 80 while ((sdo=sdo->Next)) 51 81 if (sdo->Node==node && sdo->Idx==idx && sdo->Subidx==subidx) 52 82 { 53 cout << "Warning:SDO Node #" << dec << (int)node << ", 0x";54 cout<< hex << idx << "/" << (int)subidx;55 cout<< " still pending." << endl;83 gLog << warn << MTime(-1) << " - SDO Node #" << dec << (int)node << ", 0x"; 84 gLog << hex << idx << "/" << (int)subidx; 85 gLog << " still pending." << endl; 56 86 break; 57 87 } … … 60 90 fLast = fLast->Next; 61 91 if (fMux.UnLock()==13) 62 cout << "PendingSDOList::Add - tried to unlock mutex locked by other thread." << endl;92 gLog << err << MTime(-1) << " - PendingSDOList::Add - tried to unlock mutex locked by other thread." << endl; 63 93 } 64 94 … … 69 99 70 100 if (fMux.Lock()==13) 71 cout << "PendingSDOList::Del - mutex is already locked by this thread" << endl; 101 gLog << err << MTime(-1) << " - PendingSDOList::Del - mutex is already locked by this thread" << endl; 102 103 #ifdef DEBUG 104 fout << MTime(-1) << " - Del " << idx << "/" << subidx << " @ " << node << endl; 105 #endif 106 72 107 while ((sdo=prev->Next)) 73 108 { … … 88 123 } 89 124 if (fMux.UnLock()==13) 90 cout << "PendingSDOList::Del - tried to unlock mutex locked by other thread." << endl;125 gLog << err << MTime(-1) << " - PendingSDOList::Del - tried to unlock mutex locked by other thread." << endl; 91 126 } 92 127 … … 102 137 103 138 if (fMux.Lock()==13) 104 cout << "PendingSDOList::IsPending(byte) - mutex is already locked by this thread" << endl;139 gLog << err << MTime(-1) << " - PendingSDOList::IsPending(byte) - mutex is already locked by this thread" << endl; 105 140 while ((sdo=sdo->Next)) 106 141 if (sdo->Node==node) … … 110 145 } 111 146 if (fMux.UnLock()==13) 112 cout << "PendingSDOList::IsPending(byte) - tried to unlock mutex locked by other thread." << endl;147 gLog << err << MTime(-1) << " - PendingSDOList::IsPending(byte) - tried to unlock mutex locked by other thread." << endl; 113 148 114 149 return rc; … … 121 156 122 157 if (fMux.Lock()==13) 123 cout << "PendingSDOList::IsPending - mutex is already locked by this thread" << endl;158 gLog << err << MTime(-1) << " - PendingSDOList::IsPending - mutex is already locked by this thread" << endl; 124 159 while ((sdo=sdo->Next)) 125 160 if (sdo->Node==node && sdo->Idx==idx && sdo->Subidx==subidx) … … 129 164 } 130 165 if (fMux.UnLock()==13) 131 cout << "PendingSDOList::IsPending - tried to unlock mutex locked by other thread." << endl;166 gLog << err << MTime(-1) << " - PendingSDOList::IsPending - tried to unlock mutex locked by other thread." << endl; 132 167 133 168 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.