Gromacs  2016.4
 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:

Description

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: http://sources.redhat.com/bugzilla/show_bug.cgi?id=11655 On the other hand, system qsort() might be faster than our own.

Macros

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

Functions

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