| 156 |
|
|
| 157 |
} |
} |
| 158 |
|
|
|
//BOOL scan_argv(int argc, char *argv[], char opt_name[], char *opt_value[]) { |
|
| 159 |
BOOL scan_argv(int argc, char *argv[], char opt_name[], char *opt_value) { |
BOOL scan_argv(int argc, char *argv[], char opt_name[], char *opt_value) { |
| 160 |
int i; |
int i; |
| 161 |
char * opt_current_name; |
char * opt_current_name; |
| 186 |
unsigned char *pDataBitmap; |
unsigned char *pDataBitmap; |
| 187 |
|
|
| 188 |
// workers |
// workers |
| 189 |
int workers = 5; |
int workers; |
| 190 |
int worker_index, worker_rows, worker_startrow; |
int worker_index, worker_rows, worker_startrow; |
| 191 |
HANDLE *worker_handles; |
HANDLE *worker_handles; |
| 192 |
PWORKERARGS worker_args; |
PWORKERARGS worker_args; |
| 193 |
|
int worker_count; |
| 194 |
|
|
| 195 |
// threads or processes? |
// threads or processes? |
| 196 |
BOOL use_processes = FALSE; |
BOOL use_processes = FALSE; |
| 427 |
|
|
| 428 |
} |
} |
| 429 |
|
|
|
// wait for all threads |
|
| 430 |
if (VERBOSE) |
if (VERBOSE) |
| 431 |
fprintf(stdout, "waiting for workers to finish...\n"); |
fprintf(stdout, "waiting for workers to finish...\n"); |
| 432 |
if (WaitForMultipleObjects(workers, worker_handles, TRUE, INFINITE) == WAIT_FAILED) |
|
| 433 |
printErrorAndExit("Error at WaitForMultipleObjects", GetLastError()); |
// wait for all workers |
| 434 |
|
for (worker_index = 0; worker_index < workers; worker_index += MAXIMUM_WAIT_OBJECTS) { |
| 435 |
|
worker_count = ((workers - worker_index) > MAXIMUM_WAIT_OBJECTS) ? MAXIMUM_WAIT_OBJECTS : (workers - worker_index); |
| 436 |
|
if (WaitForMultipleObjects(worker_count, &worker_handles[worker_index], TRUE, INFINITE) == WAIT_FAILED) |
| 437 |
|
printErrorAndExit("Error at WaitForMultipleObjects", GetLastError()); |
| 438 |
|
} |
| 439 |
|
|
| 440 |
// debugging: just run single thread |
// debugging: just run single thread |
| 441 |
//if (WaitForSingleObject(worker_handles[0], INFINITE) == WAIT_FAILED) |
//if (WaitForSingleObject(worker_handles[0], INFINITE) == WAIT_FAILED) |