summaryrefslogtreecommitdiffstats
path: root/include/internal
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2017-01-12 23:13:17 +0100
committerRichard Levitte <levitte@openssl.org>2017-01-13 13:10:21 +0100
commit37b8f1e21c56996644afa38816f575b05eb483ae (patch)
treef38ee702c20c8dd0bc9d59804e594021e994dbfe /include/internal
parentd62210af2e169d0818c65ff9f20ab5276693b2bf (diff)
Clarify what RUN_ONCE returns
RUN_ONCE really just returns 0 on failure or whatever the init function returned. By convention, however, the init function must return 0 on failure and 1 on success. This needed to be clarified. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2225)
Diffstat (limited to 'include/internal')
-rw-r--r--include/internal/thread_once.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/internal/thread_once.h b/include/internal/thread_once.h
index 74f6ccb238..224244353a 100644
--- a/include/internal/thread_once.h
+++ b/include/internal/thread_once.h
@@ -34,9 +34,12 @@
* RUN_ONCE - use CRYPTO_THREAD_run_once, and check if the init succeeded
* @once: pointer to static object of type CRYPTO_ONCE
* @init: function name that was previously given to DEFINE_RUN_ONCE,
- * DEFINE_RUN_ONCE_STATIC or DECLARE_RUN_ONCE.
+ * DEFINE_RUN_ONCE_STATIC or DECLARE_RUN_ONCE. This function
+ * must return 1 for success or 0 for failure.
*
- * The return value is 1 on success or 0 in case of error.
+ * The return value is 1 on success (*) or 0 in case of error.
+ *
+ * (*) by convention, since the init function must return 1 on success.
*/
#define RUN_ONCE(once, init) \
(CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)