From 636f9c7f01cb5c2b3e1825534b52ae47e5f9e228 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Wed, 30 Sep 2020 19:54:00 +0100 Subject: [PATCH] evlib: export LWS_MAX_SMP locking for evlib plugin case with SMP Now we're also looking at SMP + event lib, SMP locking pieces are going to be needed for import into the event lib plugins if built as plugins. --- include/libwebsockets/lws-eventlib-exports.h | 25 +++++++++++++++++++ lib/core/private-lib-core.h | 26 -------------------- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/include/libwebsockets/lws-eventlib-exports.h b/include/libwebsockets/lws-eventlib-exports.h index fedccc286..87c4085b3 100644 --- a/include/libwebsockets/lws-eventlib-exports.h +++ b/include/libwebsockets/lws-eventlib-exports.h @@ -58,4 +58,29 @@ lws_destroy_event_pipe(struct lws *wsi); LWS_VISIBLE LWS_EXTERN void __lws_close_free_wsi_final(struct lws *wsi); +#if LWS_MAX_SMP > 1 +struct lws_mutex_refcount { + pthread_mutex_t lock; + pthread_t lock_owner; + const char *last_lock_reason; + char lock_depth; + char metadata; +}; + +LWS_VISIBLE LWS_EXTERN void +lws_mutex_refcount_assert_held(struct lws_mutex_refcount *mr); + +LWS_VISIBLE LWS_EXTERN void +lws_mutex_refcount_init(struct lws_mutex_refcount *mr); + +LWS_VISIBLE LWS_EXTERN void +lws_mutex_refcount_destroy(struct lws_mutex_refcount *mr); + +LWS_VISIBLE LWS_EXTERN void +lws_mutex_refcount_lock(struct lws_mutex_refcount *mr, const char *reason); + +LWS_VISIBLE LWS_EXTERN void +lws_mutex_refcount_unlock(struct lws_mutex_refcount *mr); + +#endif diff --git a/lib/core/private-lib-core.h b/lib/core/private-lib-core.h index b313c6895..c92443469 100644 --- a/lib/core/private-lib-core.h +++ b/lib/core/private-lib-core.h @@ -231,32 +231,6 @@ struct lws_foreign_thread_pollfd { }; #endif /* network */ -#if LWS_MAX_SMP > 1 - -struct lws_mutex_refcount { - pthread_mutex_t lock; - pthread_t lock_owner; - const char *last_lock_reason; - char lock_depth; - char metadata; -}; - -void -lws_mutex_refcount_init(struct lws_mutex_refcount *mr); - -void -lws_mutex_refcount_destroy(struct lws_mutex_refcount *mr); - -void -lws_mutex_refcount_lock(struct lws_mutex_refcount *mr, const char *reason); - -void -lws_mutex_refcount_assert_held(struct lws_mutex_refcount *mr); - -void -lws_mutex_refcount_unlock(struct lws_mutex_refcount *mr); -#endif - #if defined(LWS_WITH_NETWORK) #include "private-lib-core-net.h" #endif