Revision 1052

branches/threaded2/src/linad99/thread_stuff.cpp (revision 1052)
21 21

  
22 22
int adpthread_manager::old_buffer_flag=0;
23 23

  
24
adpthread_manager::~adpthread_manager()
25
{
26
  //cerr << "called adpthread_manager::~adpthread_manager(); nslaves = "
27
  //     << nslaves << endl;
28
  int i;
29
  for (i=0;i<nslaves;i++)
30
  {
31
    ssmutex[i]+=i+1;
32
    delete [] ssmutex[i];
33
    ssmutex[i]=0;
34
  }
35
  delete [] ssmutex;
36
  ssmutex=0;
37
  ppf++;
38
  delete [] ppf;
39
  ppf=0;
40
  thread1++;
41
  delete [] thread1;
42
  thread1=0;
43
  buffend++;
44
  delete [] buffend;
45
  buffend=0;
46
  current_bptr++;
47
  delete [] current_bptr;
48
  current_bptr=0;
49
  for (i=0;i<nslaves;i++)
50
  {
51
    for (int j=i+1;j<=nslaves;j++)
52
    {
53
      if (stransfer_buffer[i][j])
54
      {
55
        delete [] stransfer_buffer[i][j];
56
        stransfer_buffer[i][j]=0;
57
      }
58
    }
59
  }
60
  for (i=0;i<nslaves;i++)
61
  {
62
    stransfer_buffer[i]+=i+1;
63
    delete [] stransfer_buffer[i];
64
    stransfer_buffer[i]=0;
65
  }
66
  delete [] stransfer_buffer;
67
  stransfer_buffer=0;
68
}
69 24

  
70 25
adpthread_manager::adpthread_manager(int ns,int bs) : buffer_size(1,ns),
71 26
  mflag(1,ns), sflag(1,ns), num_in_group(1,1),ngroups(1),
......
111 66
  smflag.initialize();
112 67
  ssflag.initialize();
113 68
  
114
  for (i=1;i<=ns;i++)
115
  {
116
    transfer_buffer[i]=new char[bs];
117
    current_bptr[i]=transfer_buffer[i];
118
    buffend[i]=transfer_buffer[i]+bs-1;
119
  }
120
  smutex=new pthread_mutex_t[ns];
121
  smutex--;
122
  for (i=1;i<=ns;i++)
123
  {
124
    pthread_mutex_init(smutex+i,NULL);
125
  }
126
  scondition=new pthread_cond_t[ns];
127
  scondition--;
128
  mcondition=new pthread_cond_t[ns];
129
  mcondition--;
130
  for (i=1;i<=ns;i++)
131
  {
132
    pthread_cond_init(scondition+i,0);
133
    pthread_cond_init(mcondition+i,0);
134
  }
135
  thread1=new pthread_t[ns];
136
  thread1--;
137
  pthread_mutex_init(&copy_mutex,NULL);
138
  pthread_mutex_init(&start_mutex,NULL);
139 69
  ssmutex=new ppthread_mutex_t[ns];
140 70
  for (i=0;i<ns;i++)
141 71
  {
142 72
    ssmutex[i]=new pthread_mutex_t[ns-i];
143 73
    ssmutex[i]-=i+1;
144 74
  }
75

  
145 76
  sbuffer_size.allocate(0,ns-1);
146 77
  for (i=0;i<ns;i++)
147 78
  {
......
149 80
  }
150 81
  sbuffer_size.initialize();
151 82

  
152
  stransfer_buffer=new ppchar[ns];
83
 stransfer_buffer=new ppchar[ns];
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff