summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2010-09-20 15:44:31 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2010-09-20 15:45:49 -0700
commit9065006ccbe0a94e9536950f389a0cbc3dfb4dda (patch)
tree45e9dc62c0d641cd0f143cad029850108031a610 /src
parent4727aab1b1964913cb83db65d59ba65c198d9d84 (diff)
downloadcoreutils-9065006ccbe0a94e9536950f389a0cbc3dfb4dda.tar.xz
sort: destroy spin locks portably
* src/sort.c (sortlines, sort): Use pthread_spin_destroy when a spin lock is no longer used. This isn't needed on GNU/Linux or Solaris, but POSIX says it may free up resources on some platforms.
Diffstat (limited to 'src')
-rw-r--r--src/sort.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/sort.c b/src/sort.c
index a8d0c142b..89f7be32c 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -3480,6 +3480,8 @@ sortlines (struct line *restrict lines, struct line *restrict dest,
queue_insert (merge_queue, &node);
merge_loop (merge_queue, total_lines, tfp, temp_output);
}
+
+ pthread_spin_destroy (&lock);
}
/* Scan through FILES[NTEMPS .. NFILES-1] looking for a file that is
@@ -3765,6 +3767,7 @@ sort (char * const *files, size_t nfiles, char const *output_file,
sortlines (line, line, nthreads, buf.nlines, &node, true,
&merge_queue, tfp, temp_output);
queue_destroy (&merge_queue);
+ pthread_spin_destroy (&lock);
}
else
write_unique (line - 1, tfp, temp_output);