Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/P-p-H-d/mlib.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Pelissier <patrick.pelissier@gmail.com>2021-02-08 01:02:02 +0300
committerPatrick Pelissier <patrick.pelissier@gmail.com>2021-02-08 01:04:59 +0300
commit25497bd96fe15e29571871ec5a5511f08f0bcc41 (patch)
treef109cbe880d0db13ec706c97c8844c9f521a9603 /m-concurrent.h
parentd12b1edc3900158f6efa8f44e7300b1606ca4983 (diff)
Factorize code so that _DEF macros use _DEF_AS ones
Diffstat (limited to 'm-concurrent.h')
-rw-r--r--m-concurrent.h28
1 files changed, 10 insertions, 18 deletions
diff --git a/m-concurrent.h b/m-concurrent.h
index 2a1e788..d7eaecf 100644
--- a/m-concurrent.h
+++ b/m-concurrent.h
@@ -33,11 +33,7 @@
based on the given container.
USAGE: CONCURRENT_DEF(name, type [, oplist_of_the_type]) */
#define CONCURRENT_DEF(name, ...) \
- M_BEGIN_PROTECTED_CODE \
- CONCURRENTI_DEF_P1(M_IF_NARGS_EQ1(__VA_ARGS__) \
- ((name, __VA_ARGS__, M_GLOBAL_OPLIST_OR_DEF(__VA_ARGS__)(), M_C(name,_t) ), \
- (name, __VA_ARGS__, M_C(name,_t) ))) \
- M_END_PROTECTED_CODE
+ CONCURRENT_DEF_AS(name, M_C(name,_t), __VA_ARGS__)
/* Define a protected concurrent container and its associated functions
@@ -51,24 +47,12 @@
M_END_PROTECTED_CODE
-/* Define the oplist of a protected concurrent container given its name and its oplist.
- USAGE: CONCURRENT_OPLIST(name[, oplist of the type]) */
-#define CONCURRENT_OPLIST(...) \
- CONCURRENTI_OPLIST_P1(M_IF_NARGS_EQ1(__VA_ARGS__) \
- ((__VA_ARGS__, M_DEFAULT_OPLIST), \
- (__VA_ARGS__ )))
-
-
/* Define a protected concurrent container and its associated functions
based on its given container. Operations that perform only read of the container
can be done in parallel.
USAGE: CONCURRENT_RP_DEF(name, type [, oplist_of_the_type]) */
#define CONCURRENT_RP_DEF(name, ...) \
- M_BEGIN_PROTECTED_CODE \
- CONCURRENTI_RP_DEF_P1(M_IF_NARGS_EQ1(__VA_ARGS__) \
- ((name, __VA_ARGS__, M_GLOBAL_OPLIST_OR_DEF(__VA_ARGS__)(), M_C(name,_t) ), \
- (name, __VA_ARGS__, M_C(name,_t) ))) \
- M_END_PROTECTED_CODE
+ CONCURRENT_RP_DEF_AS(name, M_C(name,_t), __VA_ARGS__)
/* Define a protected concurrent container and its associated functions
@@ -84,6 +68,14 @@
M_END_PROTECTED_CODE
+/* Define the oplist of a protected concurrent container given its name and its oplist.
+ USAGE: CONCURRENT_OPLIST(name[, oplist of the type]) */
+#define CONCURRENT_OPLIST(...) \
+ CONCURRENTI_OPLIST_P1(M_IF_NARGS_EQ1(__VA_ARGS__) \
+ ((__VA_ARGS__, M_DEFAULT_OPLIST), \
+ (__VA_ARGS__ )))
+
+
/********************************** INTERNAL ************************************/
/* Deferred evaluation for the oplist definition,