about summary refs log tree commit diff
path: root/misc/search.h
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2019-05-02 11:42:51 +0200
committerFlorian Weimer <fweimer@redhat.com>2019-05-02 11:42:51 +0200
commit7b807a35a8dc63f9742cecf0fc3db46c30e28b0d (patch)
tree0dce83854245814394b46373b4c8316ab7610b0c /misc/search.h
parent20aa5819586ac7ad11f711bab64feda307965191 (diff)
downloadglibc-7b807a35a8dc63f9742cecf0fc3db46c30e28b0d.tar.gz
glibc-7b807a35a8dc63f9742cecf0fc3db46c30e28b0d.tar.xz
glibc-7b807a35a8dc63f9742cecf0fc3db46c30e28b0d.zip
misc: Add twalk_r function
The twalk function is very difficult to use in a multi-threaded
program because there is no way to pass external state to the
iterator function.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'misc/search.h')
-rw-r--r--misc/search.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/misc/search.h b/misc/search.h
index 47e8a43436..4659c59877 100644
--- a/misc/search.h
+++ b/misc/search.h
@@ -150,6 +150,13 @@ typedef void (*__action_fn_t) (const void *__nodep, VISIT __value,
 extern void twalk (const void *__root, __action_fn_t __action);
 
 #ifdef __USE_GNU
+/* Like twalk, but pass down a closure parameter instead of the
+   level.  */
+extern void twalk_r (const void *__root,
+		     void (*) (const void *__nodep, VISIT __value,
+			       void *__closure),
+		     void *__closure);
+
 /* Callback type for function to free a tree node.  If the keys are atomic
    data this function should do nothing.  */
 typedef void (*__free_fn_t) (void *__nodep);