@@ -51,15 +51,45 @@ typedef struct mbedtls_threading_mutex_t {
5151 * mbedtls_threading_free_alt() must be called once in the main
5252 * thread after all other Mbed TLS functions.
5353 *
54- * \note mutex_init() and mutex_free() don't return a status code.
55- * If mutex_init() fails, it should leave its argument (the
56- * mutex) in a state such that mutex_lock() will fail when
57- * called with this argument.
54+ * \warning \p mutex_init and \p mutex_free don't return a status code.
55+ * If \p mutex_init fails, it should leave the mutex in
56+ * a state such that \p mutex_lock will reliably return
57+ * #MBEDTLS_ERR_THREADING_MUTEX_ERROR called on this mutex,
58+ * and \p mutex_free will do nothing.
5859 *
59- * \param mutex_init the init function implementation
60- * \param mutex_free the free function implementation
61- * \param mutex_lock the lock function implementation
62- * \param mutex_unlock the unlock function implementation
60+ * \param mutex_init The init function implementation. <br>
61+ * The behavior is undefined if the mutex is already
62+ * initialized and has not been destroyed.
63+ * On platforms where mutex initialization can fail,
64+ * since this function does not return a status code,
65+ * it must leave the mutex object in a safe state where
66+ * subsequent function calls will not cause undefined
67+ * behavior: after a call to \p mutex_init, the
68+ * function \p mutex_lock must either succeed or
69+ * fail with a nonzero status code, and the function
70+ * \p mutex_free must free any resources associated
71+ * with the mutex..
72+ * \param mutex_free The destroy function implementation. <br>
73+ * This function must free any resources associated
74+ * with the mutex object. <br>
75+ * This function must work reliably if \p mutex_init
76+ * has been called on the mutex and \p mutex_free
77+ * has not yet been called. <br>
78+ * The behavior is undefined if the mutex was not
79+ * initialized, if it has already been destroyed,
80+ * if it is currently locked, or if this function
81+ * is called concurrently from multiple threads.
82+ * \param mutex_lock The lock function implementation. <br>
83+ * This function must work reliably on any mutex
84+ * which is not currently locked and on which
85+ * \p mutex_init has already been called but
86+ * \p mutex_free has not been called yet. <br>
87+ * The behavior is undefined if the mutex was not
88+ * initialized, if it has already been destroyed, or if
89+ * it is currently locked by the calling thread.
90+ * \param mutex_unlock The unlock function implementation. <br>
91+ * The behavior is undefined if the mutex is not
92+ * currently locked by the calling thread.
6393 */
6494void mbedtls_threading_set_alt (void (* mutex_init )(mbedtls_threading_mutex_t * ),
6595 void (* mutex_free )(mbedtls_threading_mutex_t * ),
0 commit comments