+static void
+iter_blocks (lzma_index *idx, unsigned nr_threads,
+ const char *filename, int fd, const char *outputfile, int ofd)
+{
+ struct global_state global;
+ struct per_thread_state per_thread[nr_threads];
+ pthread_t thread[nr_threads];
+ unsigned u, nr_errors;
+ int err;
+ void *status;
+
+ lzma_index_iter_init (&global.iter, idx);
+ global.iter_finished = 0;
+ err = pthread_mutex_init (&global.iter_mutex, NULL);
+ if (err != 0)
+ error (EXIT_FAILURE, err, "pthread_mutex_init");
+
+ global.filename = filename;
+ global.fd = fd;
+ global.outputfile = outputfile;
+ global.ofd = ofd;
+
+ for (u = 0; u < nr_threads; ++u) {
+ per_thread[u].thread_num = u;
+ per_thread[u].global = &global;
+ }