Add comments

This commit is contained in:
Patrick Pelissier committed 2017-03-06 22:25:35 +01:00
1 parent 0c584420d7
commit a185d08734
1 file changed
+6 -1
+6 -1
View File
@@ -1,5 +1,5 @@
/* /*
* M*LIB - BUFFER & STACK interface * M*LIB - Fixed size BUFFER & STACK interface
* *
* Copyright (c) 2017, Patrick Pelissier * Copyright (c) 2017, Patrick Pelissier
* All rights reserved. * All rights reserved.
@@ -33,6 +33,7 @@
#include "m-core.h" #include "m-core.h"
#include "m-mutex.h" #include "m-mutex.h"
/* Define the different kind of policy a buffer can have. */
typedef enum { typedef enum {
BUFFER_QUEUE = 0, BUFFER_STACK = 1, BUFFER_QUEUE = 0, BUFFER_STACK = 1,
BUFFER_BLOCKING = 0, BUFFER_UNBLOCKING = 2, BUFFER_BLOCKING = 0, BUFFER_UNBLOCKING = 2,
@@ -41,11 +42,14 @@ typedef enum {
BUFFER_PUSH_OVERWRITE = 16 BUFFER_PUSH_OVERWRITE = 16
} buffer_policy_e; } buffer_policy_e;
/* Define a buffer.
USAGE: BUFFER_DEF(name, type, size_of_buffer_or_0, policy[, oplist]) */
#define BUFFER_DEF(name, type, m_size, ... ) \ #define BUFFER_DEF(name, type, m_size, ... ) \
M_IF_NARGS_EQ1(__VA_ARGS__) \ M_IF_NARGS_EQ1(__VA_ARGS__) \
(BUFFERI_DEF2(name, type, m_size,__VA_ARGS__, ()), \ (BUFFERI_DEF2(name, type, m_size,__VA_ARGS__, ()), \
BUFFERI_DEF2(name, type, m_size,__VA_ARGS__)) BUFFERI_DEF2(name, type, m_size,__VA_ARGS__))
/********************************** INTERNAL ************************************/ /********************************** INTERNAL ************************************/
#define BUFFERI_IF_CTE_SIZE(m_size) M_IF(M_BOOL(m_size)) #define BUFFERI_IF_CTE_SIZE(m_size) M_IF(M_BOOL(m_size))
@@ -237,6 +241,7 @@ static inline void \
} \ } \
// NOTE: SET & INIT_SET are deliberatly missing. TBC if it the right way. // NOTE: SET & INIT_SET are deliberatly missing. TBC if it the right way.
// NOTE: There is no oplist defined for this container.
// TODO: priority queue when it is the one with the huge priority which is taken out // TODO: priority queue when it is the one with the huge priority which is taken out
// TODO: merge queue waiting for all threads to finish producing one object to make it available to consummer (allow partial production by different threads) // TODO: merge queue waiting for all threads to finish producing one object to make it available to consummer (allow partial production by different threads)