Changeset 1710 in Sophya for trunk/ArchTOIPipe/Kernel
- Timestamp:
- Oct 19, 2001, 2:20:38 PM (24 years ago)
- Location:
- trunk/ArchTOIPipe/Kernel
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ArchTOIPipe/Kernel/fitstoirdr.cc
r1696 r1710 128 128 << firstSn << endl; 129 129 130 fits_lock();131 130 for (int i=0; i<nrows; i++) { 132 131 int anyNul; 133 132 double y; 133 fits_lock(); 134 134 fits_read_col_dbl(fptr,1,i+1,1,1,0,&y,&anyNul,&fstatus); 135 //fits_unlock();135 fits_unlock(); 136 136 int sn = (int) (y+.1); 137 137 TOIManager* mgr = TOIManager::getManager(); … … 142 142 int j = colsinput[k].first; 143 143 if ( !checkOutputTOIIndex(k) ) continue; // Reza - Si TOI non connecte 144 //fits_lock();144 fits_lock(); 145 145 fits_read_col_dbl(fptr,j+1,i+1,1,1,0,&y,&anyNul,&fstatus); 146 146 long flg = 0; … … 148 148 fits_read_col_lng(fptr,j+2,i+1,1,1,0,&flg,&anyNul,&fstatus); 149 149 } 150 //fits_unlock();150 fits_unlock(); 151 151 putData(k, sn, y, flg); 152 152 } 153 if (i%50==0) {153 /* if (i%50==0) { 154 154 fits_unlock(); 155 155 sched_yield(); 156 156 fits_lock(); 157 } 157 }*/ 158 158 totnscount++; 159 159 } 160 fits_unlock();160 //fits_unlock(); 161 161 cout << "reader done reading... " << pthread_self() << endl; 162 162 } -
trunk/ArchTOIPipe/Kernel/toisegment.cc
r1709 r1710 10 10 static void cout_lock() {pthread_mutex_lock(&cout_mutex);} 11 11 static void cout_unlock() {pthread_mutex_unlock(&cout_mutex);} 12 #define LOG(_xxx_)13 / *12 //#define LOG(_xxx_) 13 // /* 14 14 #define LOG(_xxx_) \ 15 15 cout_lock(); \ 16 16 _xxx_; \ 17 17 cout_unlock(); 18 */18 // */ 19 19 20 20 /******************************/ … … 23 23 24 24 TOISegmented::TOISegmented(int bufsz, int maxseg) { 25 master = new MasterView(bufsz, maxseg );25 master = new MasterView(bufsz, maxseg, ""); 26 26 setName("TOISegmented"); 27 27 } 28 28 29 29 TOISegmented::TOISegmented(string nm, int bufsz, int maxseg) { 30 master = new MasterView(bufsz, maxseg );30 master = new MasterView(bufsz, maxseg, nm); 31 31 setName(nm); 32 32 } … … 34 34 TOISegmented::TOISegmented(char* cnm, int bufsz, int maxseg) { 35 35 string nm = cnm; 36 master = new MasterView(bufsz, maxseg );36 master = new MasterView(bufsz, maxseg, nm); 37 37 setName(nm); 38 38 } … … 217 217 if (sn0 < 0 || 218 218 sn >= sn0 + segmentSize*segments.size()) { 219 LOG(cout << "BufferView " << hex << this << dec << ": read fault for " << sn << endl) 219 LOG(cout << master->name << " BufferView " 220 << hex << this << dec << ": read fault for " << sn << endl) 220 221 sync(); 221 222 pthread_mutex_lock(&(master->read_wait_mutex)); … … 223 224 wait(); // must be atomic with loop test 224 225 pthread_mutex_unlock(&(master->read_wait_mutex)); 225 LOG(cout << "BufferView " << hex << this << dec << ": waiting for " << sn << endl)226 LOG(cout << master->name << " BufferView " << hex << this << dec << ": waiting for " << sn << endl) 226 227 sync(); 227 228 pthread_mutex_lock(&(master->read_wait_mutex)); … … 229 230 pthread_mutex_unlock(&(master->read_wait_mutex)); 230 231 231 LOG(cout << "BufferView " << hex << this << dec << ": resuming for " << sn232 LOG(cout << master->name << " BufferView " << hex << this << dec << ": resuming for " << sn 232 233 << " now data for " << sn0 << " - " << sn0 + segmentSize*segments.size() 233 234 << " in " << segments.size() << " segments " << endl) … … 259 260 /*******************************/ 260 261 261 TOISegmented::MasterView::MasterView(int bufsz, int maxseg ) {262 TOISegmented::MasterView::MasterView(int bufsz, int maxseg, string nm) { 262 263 currentSegment = NULL; 263 264 maxSegments = maxseg; … … 265 266 sn0 = -1; 266 267 nConsumers = 0; 268 name = nm; 267 269 268 270 pthread_mutex_init(&views_mutex, NULL); … … 296 298 sn >= currentSegment->sn0 && 297 299 sn < currentSegment->sn0 + currentSegment->bufferSize)) { 298 LOG(cout << "MasterView::putData, need extend for " << sn << endl)300 LOG(cout << name << " MasterView::putData, need extend for " << sn << endl) 299 301 nextSegment(); 300 302 } … … 328 330 void TOISegmented::MasterView::signalWrite() { /* reader thread */ /* views locked */ 329 331 if (waitingOnWrite) { 330 LOG(cout << "MasterView : signal for wait on write" << endl)332 LOG(cout << name << " MasterView : signal for wait on write" << endl) 331 333 pthread_cond_signal(&write_wait_condv); // only one thread can be sleeping 332 334 } … … 362 364 363 365 void TOISegmented::MasterView::waitForCleaning() { /* writer thread */ /* views locked */ 364 LOG(cout << "MasterView : write wait for clean for " << sn0 << endl)366 LOG(cout << name << " MasterView : write wait for clean for " << sn0 << endl) 365 367 waitingOnWrite = true; 366 368 checkDeadLock(); 367 369 pthread_cond_wait(&write_wait_condv, &views_mutex); 368 LOG(cout << "MasterView : wait done" << endl)370 LOG(cout << name << " MasterView : wait done" << endl) 369 371 } 370 372 … … 403 405 } 404 406 405 LOG(cout << "MasterView : firstNeeded = " << firstNeeded << endl);407 LOG(cout << name << " MasterView : firstNeeded = " << firstNeeded << endl); 406 408 407 409 vector<BufferSegment*>::iterator j = segments.begin(); … … 447 449 } 448 450 449 LOG(cout << "sync for " << hex << bv << dec << " : "451 LOG(cout << name << " sync for " << hex << bv << dec << " : " 450 452 << oldBegin << " - " << oldEnd << " --> " 451 453 << bv->sn0 << " - " << newEnd << endl); -
trunk/ArchTOIPipe/Kernel/toisegment.h
r1699 r1710 101 101 class MasterView { 102 102 public: 103 MasterView(int bufsz=256, int maxseg=20 );103 MasterView(int bufsz=256, int maxseg=20, string nm=""); 104 104 ~MasterView(); 105 105 … … 114 114 friend class BufferView; 115 115 friend class TOISegmented; 116 string name; 116 117 void signalWaitingViews(); // views are waiting on read 117 118 void signalWrite(); // we are waiting on write
Note:
See TracChangeset
for help on using the changeset viewer.