Gromacs  2018.8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Macros | Functions
qsort_threadsafe.h File Reference
#include <stdlib.h>
#include "config.h"
+ Include dependency graph for qsort_threadsafe.h:


Portable implementation of threadsafe quicksort.

This module provides a GROMACS version of the qsort() routine defined. It is not highly optimized, but it is threadsafe, i.e. multiple threads can simultaneously call gmx_qsort() with different data.

The rational is that some implementations of qsort() are not threadsafe. For instance qsort() in glibc contains a bug which makes it not threadsafe: On the other hand, system qsort() might be faster than our own.


#define gmx_qsort_threadsafe   qsort
 Threadsafe qsort(). More...


void gmx_qsort (void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *))
 Portable threadsafe sort routine. More...