/[cvs]/joko/Uni/BSArch/04/bmp_fractal.c
ViewVC logotype

Diff of /joko/Uni/BSArch/04/bmp_fractal.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by joko, Sat Jul 1 20:31:31 2006 UTC revision 1.8 by joko, Sat Jul 1 22:10:42 2006 UTC
# Line 163  int main(int argc, char *argv[]) { Line 163  int main(int argc, char *argv[]) {
163    unsigned char *pDataBitmap, *pDataBitmapCurrent;    unsigned char *pDataBitmap, *pDataBitmapCurrent;
164    
165    // workers    // workers
166    int workers = 10;    int workers = 5;
167    int worker_index, worker_rows, worker_startrow;    int worker_index, worker_rows, worker_startrow;
168    HANDLE *worker_handles;    HANDLE *worker_handles;
169    //struct WorkerArguments *worker_args;    //struct WorkerArguments *worker_args;
# Line 217  int main(int argc, char *argv[]) { Line 217  int main(int argc, char *argv[]) {
217    if ((worker_handles = malloc(workers * sizeof worker_handles[0])) == NULL)    if ((worker_handles = malloc(workers * sizeof worker_handles[0])) == NULL)
218      perror("malloc"), exit(1);      perror("malloc"), exit(1);
219    
   /*  
220    // allocate memory for table of all worker arguments    // allocate memory for table of all worker arguments
221    if ((worker_args = malloc(workers * sizeof worker_args[0])) == NULL)    if ((worker_args = malloc(workers * sizeof worker_args[0])) == NULL)
222      perror("malloc"), exit(1);      perror("malloc"), exit(1);
223    */    
224    // allocate memory for table of all worker arguments    // allocate memory for table of all worker arguments
225    worker_args = (PWORKERARGS) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, workers * sizeof(WORKERARGS));    /*
226      worker_args = (PWORKERARGS) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY | HEAP_NO_SERIALIZE, workers * sizeof(WORKERARGS));
227    
228      if (worker_args == NULL) {
229        printErrorAndExit("Failed to allocate on heap", GetLastError());
230      }
231      */
232        
233    // calculate segments of bitmap for worker threads/processes and start them    // calculate segments of bitmap for worker threads/processes and start them
234    worker_rows = YSIZE / workers;    worker_rows = YSIZE / workers;
# Line 289  int main(int argc, char *argv[]) { Line 294  int main(int argc, char *argv[]) {
294      printErrorAndExit("Error at CloseHandle", err);      printErrorAndExit("Error at CloseHandle", err);
295    }    }
296    
297      /*
298      if (HeapFree(GetProcessHeap(), HEAP_ZERO_MEMORY | HEAP_NO_SERIALIZE, worker_args) != TRUE) {
299        printErrorAndExit("Call to HeapFree has failed", GetLastError());
300      }
301      */
302      
303      
304      return 0;
305      
306  }  }

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed