summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCalvin <calvin@EESI>2013-06-13 14:51:15 -0400
committerCalvin <calvin@EESI>2013-06-13 14:51:15 -0400
commite48d8f7a62a03b783185fcdb4906fd9d063f9c89 (patch)
tree3e4e833b39a7a74c77b7ea4dccdb5375ac7e208e
parente37cb0a27e0cc9cca59413dcfb1784ba4ff25608 (diff)
use readdir and #omp criticalv1.0.3
-rw-r--r--src/c/multifasta_to_otu.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/c/multifasta_to_otu.c b/src/c/multifasta_to_otu.c
index 6d704dd..62d9222 100644
--- a/src/c/multifasta_to_otu.c
+++ b/src/c/multifasta_to_otu.c
@@ -208,12 +208,10 @@ int main(int argc, char **argv) {
exit(EXIT_FAILURE);
}
- struct dirent result;
-
omp_set_num_threads(jobs);
long done = 0;
printf("Beginning to process samples\n");
-#pragma omp parallel for shared(solutions, sequences, width, result, done)
+ #pragma omp parallel for shared(solutions, sequences, width, done)
for(long i = 0; i < dir_count; i++ ) {
long z = 0;
@@ -225,16 +223,18 @@ int main(int argc, char **argv) {
exit(EXIT_FAILURE);
}
-#pragma omp critical
- readdir_r(input_directory_dh, &result, &directory_entry);
+ #pragma omp critical
+ {
+ directory_entry = readdir(input_directory_dh);
+ strcpy(base_filename, directory_entry->d_name);
+ }
- if(strcmp(directory_entry->d_name, "..") == 0 || strcmp(directory_entry->d_name, ".") == 0) {
+ if(strcmp(base_filename, "..") == 0 || strcmp(base_filename, ".") == 0) {
i--;
continue;
}
// get our base filenames
- strcpy(base_filename, directory_entry->d_name);
filenames[i] = base_filename;
// get our real filename