From d17fa4530bffb23c2eb4cb0658b4cfec9bed1ae9 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Sat, 5 Nov 2022 13:36:57 +0100 Subject: [PATCH] Update comments --- README.md | 3 +++ m-worker.h | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c11dcadb..dccfbe89 100644 --- a/README.md +++ b/README.md @@ -6943,6 +6943,9 @@ The following methods are available: A pool of worker. +The type is incompatible between C++, C/CLANG and C(all others) due to technical constraints, +so a variable of such a type shall always be accessed by the same compiler. + #### worker\_sync\_t A synchronization point between workers. diff --git a/m-worker.h b/m-worker.h index bb11c423..be53c820 100644 --- a/m-worker.h +++ b/m-worker.h @@ -40,7 +40,7 @@ #include "m-buffer.h" #include "m-mutex.h" -/* Include needed system header for detection of how many core on the system */ +/* Include needed system header for detection of how many cores are available in the system */ #if defined(_WIN32) # include #elif (defined(__APPLE__) && defined(__MACH__)) \ @@ -124,10 +124,10 @@ typedef struct m_work3r_order_s { is not sufficient for initialization of the structure. So let's use C++ constructor, destructor and copy constructor */ #if M_USE_WORKER_CPP_FUNCTION -# define M_WORK3R_CPP_INIT(x) (new (&(x)) m_work3r_order_ct()) +# define M_WORK3R_CPP_INIT(x) (new (&(x)) m_work3r_order_ct()) # define M_WORK3R_CPP_INIT_SET(x, y) (new (&(x)) m_work3r_order_ct(y)) -# define M_WORK3R_CPP_SET(x, y) ((x) = (y)) -# define M_WORK3R_CPP_CLEAR(x) ((&(x))->~m_work3r_order_ct()) +# define M_WORK3R_CPP_SET(x, y) ((x) = (y)) +# define M_WORK3R_CPP_CLEAR(x) ((&(x))->~m_work3r_order_ct()) # define M_WORK3R_CPP_INIT_MOVE(x,y) (new (&(x)) m_work3r_order_ct(y), ((&(y))->~m_work3r_order_ct())) # define M_WORK3R_OPLIST \ (INIT(M_WORK3R_CPP_INIT), INIT_SET(M_WORK3R_CPP_INIT_SET), \ @@ -136,7 +136,7 @@ typedef struct m_work3r_order_s { # define M_WORK3R_OPLIST M_POD_OPLIST #endif -/* Definition of a worker (implemented by a thread) */ +/* Definition of the identity of a worker thread */ typedef struct m_work3r_thread_s { m_thread_t id; } m_work3r_thread_ct; @@ -174,7 +174,7 @@ typedef struct m_worker_sync_s { struct m_worker_s *worker; // Reference to the pool of workers } m_worker_sync_t[1]; -/* Return the number of CPU of the system */ +/* Return the number of cores available in the system */ static inline int m_work3r_get_cpu_count(void) {