Revision 752 branches/threaded2/src/linad99/gradstak.cpp

gradstak.cpp (revision 752)
98 98

  
99 99
  char lastchar(char *);
100 100

  
101
  char ad_random_part[6]="tmp";
101
  //char ad_random_part[50];
102 102

  
103 103
/**
104 104
 * Description not yet available.
......
120 120
   */
121 121
  }
122 122

  
123
#include <sstream>
124
#include <thread>
125

  
123 126
/**
124 127
 * Description not yet available.
125 128
 * \param
126 129
 */
127 130
  grad_stack::grad_stack()
128 131
  {
132
    
129 133
    gradient_structure::TOTAL_BYTES = 0;
130 134
    gradient_structure::PREVIOUS_TOTAL_BYTES=0;
131 135
    true_length = gradient_structure::GRADSTACK_BUFFER_SIZE;
......
166 170
        {	      
167 171
          {
168 172
            int ierr=make_sub_directory(ad_comm::argv[on+1]);
169
            ad_comm::subdir=ad_comm::argv[on+1];
170
            string_path+=ad_comm::subdir;
171
            path=(char*) string_path;
173
            ad_comm::subdir = new adstring(ad_comm::argv[on+1]);
174
            string_path += ad_comm::subdir;
175
            path = (char*)string_path;
172 176
          }
173 177
        }
174 178
        else
......
180 184
      }   
181 185
    }
182 186
#endif
187
    std::thread::id this_thread_id = std::this_thread::get_id();
188
    std::ostringstream oss;
189
    oss << this_thread_id;
183 190
    if (path != NULL)
184 191
    {
185 192
    #  if defined ( __SUN__) ||  defined ( __GNU__)
186
      sprintf(&gradfile_name1[0],"%s/gradfil1.%s", path,ad_random_part);
193
      sprintf(&gradfile_name1[0],"%s/gradfil1%s.tmp", path, oss.str().c_str());
187 194
    #  else
188 195
      if (lastchar(path)!='\\')
189 196
      {
190
        sprintf(&gradfile_name1[0],"%s\\gradfil1.%s", path,ad_random_part);
197
        sprintf(&gradfile_name1[0],"%s\\gradfil1%s.tmp", path, oss.str().c_str());
191 198
      }
192 199
      else
193 200
      {
194
        sprintf(&gradfile_name1[0],"%sgradfil1.%s", path,ad_random_part);
201
        sprintf(&gradfile_name1[0],"%sgradfil1%s.tmp", path, oss.str().c_str());
195 202
      }
196 203
    #  endif
197 204
    }
198 205
    else
199 206
    {
200
      sprintf(&gradfile_name1[0],"gradfil1.%s",ad_random_part);
207
      sprintf(&gradfile_name1[0],"gradfil1%s.tmp", oss.str().c_str());
201 208
    }
202 209
    adstring tmps=gradfile_name1;
203 210
    add_slave_suffix(tmps);
......
215 222
      #if defined ( __SUN__) ||  defined ( __GNU__)  || defined(linux)
216 223
	if (strlen(path)>0)
217 224
	{    	
218
	  sprintf(&var_store_file_name[0],"%s/varssave.%s",path,
219
            ad_random_part);
220
	  sprintf(&gradfile_name2[0],"%s/gradfil2.%s", path,
221
            ad_random_part);
225
	  sprintf(&var_store_file_name[0],"%s/varssave%s.tmp", path, oss.str().c_str());
226
	  sprintf(&gradfile_name2[0],"%s/gradfil2%s.tmp", path, oss.str().c_str());
222 227
	}
223 228
	else
224 229
	{    	
......
228 233
      #else
229 234
        if (lastchar(path)!='\\')
230 235
        {
231
	  sprintf(&gradfile_name2[0],"%s\\gradfil2.%s", path,
232
            ad_random_part);
233
	  sprintf(&var_store_file_name[0],"%s\\varssave.%s",path,
234
            ad_random_part);
236
	  sprintf(&gradfile_name2[0],"%s\\gradfil2%s.tmp", path, oss.str().c_str());
237
	  sprintf(&var_store_file_name[0],"%s\\varssave%s.tmp", path, oss.str().c_str());
235 238
        }
236 239
        else
237 240
        {
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff