aboutsummaryrefslogtreecommitdiffstats
path: root/os/common/oslib/include/chfactory.h
diff options
context:
space:
mode:
Diffstat (limited to 'os/common/oslib/include/chfactory.h')
-rw-r--r--os/common/oslib/include/chfactory.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/os/common/oslib/include/chfactory.h b/os/common/oslib/include/chfactory.h
index 7ac414719..1804e7260 100644
--- a/os/common/oslib/include/chfactory.h
+++ b/os/common/oslib/include/chfactory.h
@@ -103,6 +103,10 @@
#error "invalid CH_CFG_FACTORY_MAX_NAMES_LENGTH value"
#endif
+#if (CH_CFG_USE_MUTEXES == FALSE) && (CH_CFG_USE_SEMAPHORES == FALSE)
+#error "CH_CFG_USE_FACTORY requires CH_CFG_USE_MUTEXES and/or CH_CFG_USE_SEMAPHORES"
+#endif
+
#if CH_CFG_USE_MEMCORE == FALSE
#error "CH_CFG_USE_FACTORY requires CH_CFG_USE_MEMCORE"
#endif
@@ -256,6 +260,14 @@ typedef struct ch_dyn_objects_fifo {
*/
typedef struct ch_objects_factory {
/**
+ * @brief Factory access mutex or semaphore.
+ */
+#if (CH_CFG_USE_MUTEXES == TRUE) || defined(__DOXYGEN__)
+ mutex_t mtx;
+#else
+ semaphore_t sem;
+#endif
+ /**
* @brief List of the registered objects.
*/
dyn_list_t obj_list;