Revision 1235 branches/threaded2merge/src/linad99/thread_stuff.cpp

thread_stuff.cpp (revision 1235)
30 30
  if (logflag)
31 31
  {
32 32
    adt=new adtimer[ns+1];
33
    logfiles=new pofstream[ns+1]; 
33
    logfiles=new pofstream[ns+1];
34 34
    adstring fname="log_master";
35 35
    logfiles[0]=new ofstream(fname);
36 36
    for (int i=1;i<=ns;i++)
......
134 134
    gmin(i)=gmax(i-1)+1;
135 135
    gmax(i)=gmin(i)+num_in_group(i)-1;
136 136
  }
137
    
137

  
138 138
  nslaves=ns;
139 139
  buffer_size.allocate(1,ns),
140 140
  mflag.allocate(1,ns);
141
  sflag.allocate(1,ns); 
141
  sflag.allocate(1,ns);
142 142
  logflag=1;
143 143
  mflag.initialize();
144 144
  sflag.initialize();
......
147 147
  if (logflag)
148 148
  {
149 149
    adt=new adtimer[ns+1];
150
    logfiles=new pofstream[ns+1]; 
150
    logfiles=new pofstream[ns+1];
151 151
    adstring fname="log_master";
152 152
    logfiles[0]=new ofstream(fname);
153 153
    for (int i=1;i<=ns;i++)
......
276 276
    stransfer_buffer[s1][s2]=new char[bs];
277 277
    scurrent_bptr[s1][s2]=stransfer_buffer[s1][s2];
278 278
    sbuffend[s1][s2]=stransfer_buffer[s1][s2]+bs-1;
279
    cout << "Initialized transfer buffer for pair " 
279
    cout << "Initialized transfer buffer for pair "
280 280
         << s1 << "  " << s2 << endl;
281 281
  }
282
  
283
  // if the buffer is too small on read theree is an error
282

  
283
  // if the buffer is too small on read there is an error
284 284
  if (scurrent_bptr[s1][s2]+nbytes>sbuffend[s1][s2])
285 285
  {
286 286
    std::ptrdiff_t pd=scurrent_bptr[s1][s2]-stransfer_buffer[s1][s2];
......
302 302
  {
303 303
    //if (scurrent_bptr[s1][s2]+nbytes>sbuffend[s1][s2])
304 304
    if (scurrent_bptr[s1][s2]+nbytes<=sbuffend[s1][s2]) break;
305
  
305

  
306 306
    std::ptrdiff_t pd=scurrent_bptr[s1][s2]-stransfer_buffer[s1][s2];
307 307
    std::ptrdiff_t pd1=sbuffend[s1][s2]-stransfer_buffer[s1][s2];
308 308
    cout << "scurrent offset is " << pd << " bytes " << endl;
......
354 354
  pthread_attr_setschedpolicy(&policy_attr, SCHED_FIFO);
355 355
  cerr << "In adpthread_manager::create_all, set policy to = " << SCHED_FIFO << endl;
356 356
  #endif //USE_FIFO_POLICY
357
  
357

  
358 358
  //int pthread_attr_setinheritsched(pthread_attr_t *attr, int inheritsched);
359 359
  pthread_attr_setinheritsched(&policy_attr, PTHREAD_EXPLICIT_SCHED);
360 360

  
361
  new_thread_data * dptr = (new_thread_data *)ptr; 
361
  new_thread_data * dptr = (new_thread_data *)ptr;
362 362
  int ii=0;
363 363
  for (int i=1;i<=ngroups;i++)
364 364
  {
......
439 439
  }
440 440
  check_buffer_size_read(nbytes,s1,s2);
441 441

  
442
  void * x= (void *)(_x); 
442
  void * x= (void *)(_x);
443 443
  ::memcpy(x,scurrent_bptr[s1][s2],nbytes);
444 444
  scurrent_bptr[s1][s2]+=nbytes;
445 445
}
......
910 910
  readbuffer(s,sz,sno);
911 911
  s[sz] = '\0';
912 912
  adstring x(s);
913
  delete [] s;  
913
  delete [] s;
914 914
  s = 0;
915 915
  return x;
916 916
}

Also available in: Unified diff