Changeset 1773 in Sophya


Ignore:
Timestamp:
Nov 16, 2001, 3:10:43 PM (24 years ago)
Author:
aubourg
Message:

race condition magique

Location:
trunk/ArchTOIPipe/Kernel
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ArchTOIPipe/Kernel/toiprocessor.cc

    r1762 r1773  
    33//                               Christophe Magneville
    44//                               Reza Ansari
    5 // $Id: toiprocessor.cc,v 1.19 2001-11-13 16:22:47 aubourg Exp $
     5// $Id: toiprocessor.cc,v 1.20 2001-11-16 14:10:42 aubourg Exp $
    66
    77#include "toiprocessor.h"
     
    373373void TOIProcessor::autoWontNeed(int iCur) {
    374374  if (neededHistory <=0) return;
    375   if (iCur < lastAWN + neededHistory) return;
     375  if (iCur < lastAWN + neededHistory/10) return;
    376376  lastAWN = iCur;
    377377  // cout << name << " wontNeedBefore "  << iCur-neededHistory << endl;
  • trunk/ArchTOIPipe/Kernel/toisegment.cc

    r1763 r1773  
    33//                               Christophe Magneville
    44//                               Reza Ansari
    5 // $Id: toisegment.cc,v 1.22 2001-11-14 13:45:39 aubourg Exp $
     5// $Id: toisegment.cc,v 1.23 2001-11-16 14:10:43 aubourg Exp $
    66
    77#include "toisegment.h"
     
    240240  firstNeeded = -1;
    241241  waiting = false;
     242  waitingFor = -1;
    242243}
    243244
     
    295296    pthread_mutex_lock(&(master->read_wait_mutex));
    296297    while (sn0<0 || sn >= sn0 + segmentSize*segments.size()) {
    297       wait(); // must be atomic with loop test // $CHECK$ est-ce vrai ?
     298      wait(sn); // must be atomic with loop test // $CHECK$ est-ce vrai ?
    298299      pthread_mutex_unlock(&(master->read_wait_mutex));
    299300      LOG(cout << master->name << " BufferView " << hex << this << dec << ": waiting for " << sn << endl)
     
    313314}
    314315
    315 void TOISegmented::BufferView::wait() { /* reader thread, master read wait lock taken */
     316void TOISegmented::BufferView::wait(int sn) { /* reader thread, master read wait lock taken */
    316317  //pthread_mutex_lock(&(master->read_wait_mutex));
    317318  waiting = true;
     319  waitingFor = sn;
    318320  master->waitingViews++;
    319321  pthread_cond_wait(&(master->read_wait_condv), &(master->read_wait_mutex));
    320322  waiting = false;
     323  waitingFor = -1;
    321324  master->waitingViews--;
    322325  //pthread_mutex_unlock(&(master->read_wait_mutex));
  • trunk/ArchTOIPipe/Kernel/toisegment.h

    r1766 r1773  
    55//                               Christophe Magneville
    66//                               Reza Ansari
    7 // $Id: toisegment.h,v 1.14 2001-11-14 14:49:05 aubourg Exp $
     7// $Id: toisegment.h,v 1.15 2001-11-16 14:10:43 aubourg Exp $
    88
    99#ifndef TOISEGMENT_H
     
    180180
    181181    bool waiting;
     182    int  waitingFor;
    182183
    183184    friend class MasterView;
Note: See TracChangeset for help on using the changeset viewer.