Changeset 3178 in Sophya for trunk/SophyaProg


Ignore:
Timestamp:
Feb 6, 2007, 3:05:52 PM (19 years ago)
Author:
ansari
Message:

zthr: test avec synchronisationPb lors de destruction NDataBlock, tentative de contourner , Reza 06/02/2007

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaProg/Tests/zthr.cc

    r3177 r3178  
    9696// Structure de gestion utilisee par la classe MTVecPool
    9797typedef struct {
     98  TVector<int_8> vv;
    9899  bool busy;
    99100  int stat;
     
    119120  ~MTVecPool()   { }
    120121  // Renvoie un pointeur de vecteur pour thread tid
    121   TVector<int_8>  GetVec(uint_4 tid, uint_4& idx)
     122  TVector<int_8>*  GetVec(uint_4 tid, uint_4& idx)
    122123  {
    123124    if (tid >= _nth) ParmError("MTVecPool::getvec() tid > _nth");
     
    127128      St_VecPool stv;
    128129      idx = _vecs.size();
     130      stv.vv = _vmx.Column(idx);
    129131      stv.busy = true;
    130132      stv.stat = 0;
    131133      _vecs.push_back(stv);
    132134      mex.unlock();
    133       //DBG cout << "DBG-GetVec(tid= " << tid << ") -> Idx=" << idx << " VecSz=" << _vmx.Column(idx).Size() << endl;
    134       return (_vmx.Column(idx));
     135      //DBG cout << "DBG-GetVec(tid= " << tid << ") -> Idx=" << idx << " VecSz=" << &(_vecs[idx].vv) << endl;
     136      return (&(_vecs[idx].vv));
    135137    }
    136138    else {
     
    148150          mex.unlock();
    149151          //DBG  cout << "DBG-GetVec(tid= " << tid << ") -> nv=" << hex << rv << dec << endl;
    150           return (_vmx.Column(idx));
     152          return (&(_vecs[idx].vv));
    151153        }
    152154        else {
     
    158160  }
    159161
    160   // Retourne le pointeur de vecteur au gestionnaire, qui le marque comme disponible
     162  // Retourne l'index du vecteur au gestionnaire, qui le marque comme disponible
    161163  void RetVec(uint_4 idx)
    162164  {
     
    182184        nerr++;
    183185      }
    184       _vmx.Column(k) -= sum;
    185       _vmx.Column(k).MinMax(min, max);
     186      _vecs[k].vv -= sum;
     187      _vecs[k].vv.MinMax(min, max);
    186188      if ((min!=0) || (max!=0)) {
    187189        cout << " Check()/Pb vec[k=" << k << "] != (sum=" << sum << ")" << endl;
     
    225227  uint_4 idx;
    226228  for(k=0; k<L; k++) {
    227     mtvp->GetVec(tid, idx) += p2;
     229    *(mtvp->GetVec(tid, idx)) += p2;
    228230    //DBG cout << "DBG-sync_funzt(tid=" << tid << ", idx=" << idx << endl;
    229231    mtvp->RetVec(idx);
Note: See TracChangeset for help on using the changeset viewer.