X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=doc%2Frrdthreads.html;h=36b365081ffe4b9e30d8fff8f386575c9830d352;hb=43d79b11a51ae02b7b0995945cb351799e932d66;hp=7375bc8e247d9f602a75b766f51afc0f9b663ed7;hpb=ffa00ac697dccce18dca8880ca7a14066521ac5c;p=pkg-rrdtool.git diff --git a/doc/rrdthreads.html b/doc/rrdthreads.html index 7375bc8..36b3650 100644 --- a/doc/rrdthreads.html +++ b/doc/rrdthreads.html @@ -1,14 +1,18 @@ + rrdthreads + -

+ +
+

+ + +

@@ -42,98 +50,102 @@ 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.

+way. They all end in the usual "_r" suffix.


DESCRIPTION

In order to use librrd in multi-threaded programs you must:

+with a SIGSEGV in a low-memory situation.

+ +
  • +

    Always call rrd_error_clear() before any call to the +library. Otherwise the call might fail due to some earlier error.

    +
  • +

    NOTES FOR RRD CONTRIBUTORS

    Some precautions must be followed when developing RRD from now on:

    + +
  • +

    A header file named rrd_is_thread_safe.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. -

    -
  • -Do not introduce global variables! +thread-safe.

    + +
  • +

    Do not introduce global variables!

    If you really, really have to use a global variable you may add a new -field to the rrd_context structure and modify rrd_error.c, -rrd_thread_safe.c and rrd_non_thread_safe.c

    -

    -
  • -Do not use getopt or getopt_long in *_r (neither directly nor -indirectly). +field to the rrd_context structure and modify rrd_error.c, +rrd_thread_safe.c and rrd_non_thread_safe.c

    + +
  • +

    Do not use getopt or getopt_long in *_r (neither directly nor +indirectly).

    getopt uses global variables and behaves badly in a multi-threaded application when called concurrently. Instead provide a *_r function taking all options as function parameters. You may provide argc and **argv arguments for variable length argument lists. See rrd_update_r as an example.

    -

    -
  • -Do not use the rrd_parsetime function! + +
  • +

    Do not use the rrd_parsetime function!

    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_create_r)

    -

    +
  • +

    CURRENTLY IMPLEMENTED THREAD SAFE FUNCTIONS