From b92bae34eb2462fd40188cadc68c3c60438ae4ca Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Sat, 9 Nov 2024 14:54:16 +0100 Subject: [PATCH] Update comments --- m-shared-ptr.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/m-shared-ptr.h b/m-shared-ptr.h index 87adedbf..f7cfdee0 100644 --- a/m-shared-ptr.h +++ b/m-shared-ptr.h @@ -29,6 +29,24 @@ #include "m-atomic.h" #include "m-thread.h" +/* There are two kinds of shared pointer: + * * weak shared pointer (support only one thread) + * * shared pointer (support for multiple threads both for the counter and lock for the data) + * + * There are 3 flavors: + * * DECL : for header files, declare only the functions. + * * DEF_EXTERN: for source files, define the functions (to be used with DECL) + * * DEF: for header/source files, define the function as static inline. + * + * You can provide or not the name of the shared pointer (_AS) + * + * Therefore we got 12 macros. + * + * There are 2 oplists: + * * one to handle the shared pointer itself (ie.a copy create a new pointer to the data), + * * one to handle the data behind the shared pointer (ie. a copy create a new data) +*/ + /* Declare a shared weak pointer (not atomic, single thread) for use in header file. oplist is mandatory but is only used to test if a function has to be declared */ #define M_SHARED_WEAK_PTR_DECL(name, oplist) \ @@ -93,6 +111,7 @@ ((name, shared_t, __VA_ARGS__, M_GLOBAL_OPLIST_OR_DEF(__VA_ARGS__)(), static inline ), \ (name, shared_t, __VA_ARGS__, static inline ))) + /* Define the oplist of a shared pointer given its name and its oplist. Oplist is mandatory. USAGE: SHARED_PTR_OPLIST(name, oplist of the type) */