X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=doc%2Frrdthreads.pod;h=71506e99e58beac49640be9b7313ab96da15dc84;hb=844146539c59e3fe0a5a4a1975c9dacd8db7093c;hp=6d40c4ef921e3b2aae3b84f101b9a16ce58421ff;hpb=d828f3eccac8dbad7bfc14812e406377669baaa4;p=rrdtool.git diff --git a/doc/rrdthreads.pod b/doc/rrdthreads.pod index 6d40c4e..71506e9 100644 --- a/doc/rrdthreads.pod +++ b/doc/rrdthreads.pod @@ -1,6 +1,6 @@ =head1 NAME - rrdthreads - Provisions for linking the RRD library to use in multi-threaded programs +rrdthreads - Provisions for linking the RRD library to use in multi-threaded programs =head1 SYNOPSIS @@ -9,37 +9,37 @@ precautions, as the RRD library in its original form was not thread-safe at all. This document describes requirements and pitfalls on the way to use the multi-threaded version of librrd in your own programs. It also gives hints for future RRD development to keep the -library thread-safe.. +library thread-safe. Currently only some RRD operations are implemented in a thread-safe -way. They all end in the usual "C<_r>" prefix. +way. They all end in the usual "C<_r>" suffix. =head1 DESCRIPTION -In order to use the librrd in multi-threaded programs you must: +In order to use librrd in multi-threaded programs you must: -=over 4 +=over -=item * +=item * -Link with F instead of with F (use C<-lrrd_th> when +Link with F instead of F (use C<-lrrd_th> when linking) -=item * +=item * -Use the "C<_r>" functions instead or the normal API-functions +Use the "C<_r>" functions instead of the normal API-functions -=item * +=item * Do not use any at-style time specifications. Parsing of such time specifications is terribly non-thread-safe. -=item * +=item * Never use non *C<_r> functions unless it is explicitly documented that -the function is tread-safe +the function is tread-safe. -=item * +=item * Every thread SHOULD call C before its first call to any C function in order to set up thread specific data. This @@ -54,19 +54,19 @@ library. Otherwise the call might fail due to some earlier error. =back -=head1 IMPORTANT NOTES FOR RRD CONTRIBUTORS: +=head2 NOTES FOR RRD CONTRIBUTORS Some precautions must be followed when developing RRD from now on: -=over 4 +=over =item * Only use thread-safe functions in library code. Many often used libc functions aren't thread-safe. Take care in the following -situations/when using the following library functions: +situations or when using the following library functions: -=over 8 +=over =item * @@ -93,11 +93,13 @@ C: use C =item * -Many other (lookup documentation) +Many others (lookup documentation) =back -As an aide(?) a header file named F is provided +=item * + +A header file named F is provided that works with the GNU C-preprocessor to "poison" some of the most common non-thread-safe functions using the C<#pragma GCC poison> directive. Just include this header in source files you want to keep @@ -113,8 +115,8 @@ F and F =item * -Do not use C or C in *C<_r> (directly or -indirectly) +Do not use C or C in *C<_r> (neither directly nor +indirectly). C uses global variables and behaves badly in a multi-threaded application when called concurrently. Instead provide a *_r function @@ -124,27 +126,19 @@ C as an example. =item * -Do not use the C function! +Do not use the C function! -It uses lots of global vars. You may use it in functions not designed -to be thread-safe like functions wrapping the C<_r> version of some -operation (eg. C, but not in C) +It uses lots of global variables. You may use it in functions not designed +to be thread-safe, like in functions wrapping the C<_r> version of some +operation (e.g., C, but not in C) =back -=head1 CURRENTLY IMPLEMENTED THREAD SAFE FUNCTIONS +=head2 CURRENTLY IMPLEMENTED THREAD SAFE FUNCTIONS -Currently there exit thread-safe variants of C, -C, C, C and C. +Currently there exist thread-safe variants of C, +C, C, C, C, and C. =head1 AUTHOR -Initial multi-threading support was implemented by Peter Stamfest - in Feb. 2003. - -This documentation was written by Peter Stamfest. - -Changes to the RRD library and this documentation are (c) 2003 by -Peter Stamfest and are distributed under the GPL. - -=cut +Peter Stamfest Epeter@stamfest.atE