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

thread_stuff.cpp (revision 1234)
7 7
#  endif
8 8
#endif
9 9

  
10
typedef char * pchar;
11
typedef pchar *  ppchar;
12
typedef ofstream * pofstream;
10
typedef char* pchar;
11
typedef pchar* ppchar;
12
typedef ofstream* pofstream;
13 13
__thread int adpthread_manager::slave_number;
14 14

  
15 15
adpthread_manager::adpthread_manager(int ns,int bs) : buffer_size(1,ns),
......
24 24
  logflag=0;
25 25
  mflag.initialize();
26 26
  sflag.initialize();
27
  int i;
28 27
  buffer_size=bs;
29 28
  nslaves=ns;
30 29
  // for timing 0 is for master 1-n for slaves
......
34 33
    logfiles=new pofstream[ns+1]; 
35 34
    adstring fname="log_master";
36 35
    logfiles[0]=new ofstream(fname);
37
    for (i=1;i<=ns;i++)
36
    for (int i=1;i<=ns;i++)
38 37
    {
39 38
      adstring fname="log_slave_" + str(i);
40 39
      logfiles[i]=new ofstream(fname);
......
42 41
  }
43 42
  ssflag.allocate(0,ns-1);
44 43
  smflag.allocate(0,ns-1);
45
  for (i=0;i<ns;i++)
44
  for (int i=0;i<ns;i++)
46 45
  {
47 46
    ssflag(i).allocate(i+1,ns);
48 47
    smflag(i).allocate(i+1,ns);
49 48
  }
50 49
  smflag.initialize();
51 50
  ssflag.initialize();
52
  
53 51
  ssmutex=new ppthread_mutex_t[ns];
54
  for (i=0;i<ns;i++)
52
  for (int i=0;i<ns;i++)
55 53
  {
56 54
    ssmutex[i]=new pthread_mutex_t[ns-i];
57 55
    ssmutex[i]-=i+1;
58 56
  }
59

  
60 57
  sbuffer_size.allocate(0,ns-1);
61
  for (i=0;i<ns;i++)
58
  for (int i=0;i<ns;i++)
62 59
  {
63 60
    sbuffer_size(i).allocate(i+1,ns);
64 61
  }
65 62
  sbuffer_size.initialize();
66

  
67
 stransfer_buffer=new ppchar[ns];
68

  
69
  for (i=0;i<ns;i++)
63
  stransfer_buffer=new ppchar[ns];
64
  for (int i=0;i<ns;i++)
70 65
  {
71 66
    stransfer_buffer[i]=new pchar[ns-i];
72 67
    stransfer_buffer[i]-=i+1;
73 68
  }
74 69
  scurrent_bptr=new ppchar[ns];
75
  for (i=0;i<ns;i++)
70
  for (int i=0;i<ns;i++)
76 71
  {
77 72
    scurrent_bptr[i]=new pchar[ns-i];
78 73
    scurrent_bptr[i]-=i+1;
79 74
  }
80

  
81
 sbuffend=new ppchar[ns];
82
  for (i=0;i<ns;i++)
75
  sbuffend=new ppchar[ns];
76
  for (int i=0;i<ns;i++)
83 77
  {
84 78
    sbuffend[i]=new pchar[ns-i];
85 79
    sbuffend[i]-=i+1;
86 80
  }
87

  
88
  for (i=0;i<ns;i++)
81
  for (int i=0;i<ns;i++)
89 82
  {
90 83
    for (int j=i+1;j<=ns;j++)
91 84
    {
......
94 87
      sbuffend[i][j]=0;
95 88
    }
96 89
  }
97

  
98
  for (i=0;i<ns;i++)
90
  for (int i=0;i<ns;i++)
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff