X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=doc%2Frrdthreads.txt;h=3db8d76c3ced745d1d9029315e40c647249c3dc8;hb=91b2f1022a195d008d818f283690ef63a00fd79c;hp=21ed7927095c35df76f18ebdd053e4f11c3e2b2f;hpb=ffa00ac697dccce18dca8880ca7a14066521ac5c;p=pkg-rrdtool.git diff --git a/doc/rrdthreads.txt b/doc/rrdthreads.txt index 21ed792..3db8d76 100644 --- a/doc/rrdthreads.txt +++ b/doc/rrdthreads.txt @@ -7,11 +7,12 @@ NNAAMMEE multi-threaded programs SSYYNNOOPPSSIISS - Using librrd in multi-threaded programs requires some extra precau- - tions, 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. + Using librrd in multi-threaded programs requires some extra + 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. Currently only some RRD operations are implemented in a thread-safe way. They all end in the usual ""_r"" suffix. @@ -38,20 +39,20 @@ DDEESSCCRRIIPPTTIIOONN · Always call "rrd_error_clear()" before any call to the library. Otherwise the call might fail due to some earlier error. - NNOOTTEESS FFOORR RRRRDD CCOONNTTRRIIBBUUTTOORRSS - + NNOOTTEESS FFOORR RRRRDD CCOONNTTRRIIBBUUTTOORRSS Some precautions must be followed when developing RRD from now on: · Only use thread-safe functions in library code. Many often used - libc functions aren't thread-safe. Take care in the following situ- - ations or when using the following library functions: + libc functions aren't thread-safe. Take care in the following + situations or when using the following library functions: - · Direct calls to "strerror()" must be avoided: use "rrd_str- - error()" instead, it provides a per-thread error message. + · Direct calls to "strerror()" must be avoided: use + "rrd_strerror()" instead, it provides a per-thread error + message. · The "getpw*", "getgr*", "gethost*" function families (and some - more "get*" functions) are not thread-safe: use the *"_r" vari- - ants + more "get*" functions) are not thread-safe: use the *"_r" + variants · Time functions: "asctime", "ctime", "gmtime", "localtime": use *"_r" variants @@ -65,8 +66,8 @@ DDEESSCCRRIIPPTTIIOONN · A header file named _r_r_d___i_s___t_h_r_e_a_d___s_a_f_e_._h is provided that works with the GNU C-preprocessor to "poison" some of the most common non-thread-safe functions using the "#pragma GCC poison" directive. - Just include this header in source files you want to keep - thread-safe. + Just include this header in source files you want to keep thread- + safe. · Do not introduce global variables! @@ -87,17 +88,16 @@ DDEESSCCRRIIPPTTIIOONN It uses lots of global variables. You may use it in functions not designed to be thread-safe, like in functions wrapping the "_r" - version of some operation (e.g., "rrd_create", but not in "rrd_cre- - ate_r") - - CCUURRRREENNTTLLYY IIMMPPLLEEMMEENNTTEEDD TTHHRREEAADD SSAAFFEE FFUUNNCCTTIIOONNSS + version of some operation (e.g., "rrd_create", but not in + "rrd_create_r") - Currently there exist thread-safe variants of "rrd_update", "rrd_cre- - ate", "rrd_dump", "rrd_info", "rrd_last", and "rrd_fetch". + CCUURRRREENNTTLLYY IIMMPPLLEEMMEENNTTEEDD TTHHRREEAADD SSAAFFEE FFUUNNCCTTIIOONNSS + Currently there exist thread-safe variants of "rrd_update", + "rrd_create", "rrd_dump", "rrd_info", "rrd_last", and "rrd_fetch". AAUUTTHHOORR Peter Stamfest -1.3.99909060808 2008-06-08 RRDTHREADS(1) +1.4.2 2008-06-08 RRDTHREADS(1)