summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2023-02-21 11:18:58 +0100
committerHugo Landau <hlandau@openssl.org>2023-03-30 12:14:07 +0200
commit2b2b26788e7e46abb8fb340d49a088184fbc0b9b (patch)
treebc8fa45b9ba5caff1cf984ac7a474bfb6d85f7b1 /include
parentAdd some documentation for the new advanced s_client command mode (diff)
downloadopenssl-2b2b26788e7e46abb8fb340d49a088184fbc0b9b.tar.xz
openssl-2b2b26788e7e46abb8fb340d49a088184fbc0b9b.zip
threading: Add ossl_crypto_condvar_wait_timeout
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/20348)
Diffstat (limited to 'include')
-rw-r--r--include/internal/thread_arch.h3
-rw-r--r--include/internal/time.h3
2 files changed, 6 insertions, 0 deletions
diff --git a/include/internal/thread_arch.h b/include/internal/thread_arch.h
index bf00000606..c8607d50a4 100644
--- a/include/internal/thread_arch.h
+++ b/include/internal/thread_arch.h
@@ -11,6 +11,7 @@
# define OSSL_INTERNAL_THREAD_ARCH_H
# include <openssl/configuration.h>
# include <openssl/e_os2.h>
+# include "internal/time.h"
# if defined(_WIN32)
# include <windows.h>
@@ -44,6 +45,8 @@ void ossl_crypto_mutex_free(CRYPTO_MUTEX **mutex);
CRYPTO_CONDVAR *ossl_crypto_condvar_new(void);
void ossl_crypto_condvar_wait(CRYPTO_CONDVAR *cv, CRYPTO_MUTEX *mutex);
+void ossl_crypto_condvar_wait_timeout(CRYPTO_CONDVAR *cv, CRYPTO_MUTEX *mutex,
+ OSSL_TIME deadline);
void ossl_crypto_condvar_broadcast(CRYPTO_CONDVAR *cv);
void ossl_crypto_condvar_free(CRYPTO_CONDVAR **cv);
diff --git a/include/internal/time.h b/include/internal/time.h
index 604f9e06d9..968ebbe6bd 100644
--- a/include/internal/time.h
+++ b/include/internal/time.h
@@ -35,6 +35,9 @@ typedef struct {
/* One microsecond. */
# define OSSL_TIME_US (OSSL_TIME_MS / 1000)
+/* One nanosecond. */
+# define OSSL_TIME_NS (OSSL_TIME_US / 1000)
+
#define ossl_seconds2time(s) ossl_ticks2time((s) * OSSL_TIME_SECOND)
#define ossl_time2seconds(t) (ossl_time2ticks(t) / OSSL_TIME_SECOND)
#define ossl_ms2time(ms) ossl_ticks2time((ms) * OSSL_TIME_MS)