Patrick Pelissier
f7b3de2750
Add test cases for _init_set & _set for buffers
2018-10-26 22:05:14 +02:00
Patrick Pelissier
41cf523dfc
Adding _set & _init_set for buffer (to test)
2018-10-26 21:21:29 +02:00
Patrick Pelissier
2e3b312fab
Fix issue of recursive usage of M_GLOBAL_OPLIST_OR_DEF
...
Update the way to use the macro to avoid being limited by the
preprocessor limitation.
2018-09-14 20:57:55 +02:00
Patrick Pelissier
bb8de993b6
Start porting to M_CALL infrastructure, enabling support for
...
API transformation.
2018-09-08 22:49:12 +02:00
Patrick Pelissier
3b0e940284
Add missing _ptr & _srcptr alias.
2018-08-19 17:58:23 +02:00
Patrick Pelissier
5c8429a7bb
Reformating
2018-08-16 07:29:22 +02:00
Patrick Pelissier
824011657a
Improve once again mapping of the buffer structure to avoid
...
false sharing.
2018-08-15 10:33:20 +02:00
Patrick Pelissier
8e2031bf5a
Add comments.
2018-08-15 10:30:17 +02:00
Patrick Pelissier
8bb5f5475e
Avoid putting the push mutex & the pop mutex inside the same cache line.
...
Avoid false sharing for multi-threading scenario and should increase performance.
2018-08-15 10:21:23 +02:00
Patrick Pelissier
aba1ac1646
Fix issue in 64 bits with overwriting enabled for buffer.
2018-08-02 23:31:48 +02:00
Patrick Pelissier
96202aa78f
Do not use reserved identifiers of the C standard (See 7.1.3 Reserved identifiers)
2018-07-14 14:35:14 +02:00
Patrick Pelissier
70a4fd99f4
iFix buiild issue with mutex based atomics.
2018-06-29 21:43:33 +02:00
Patrick Pelissier
0bf84a321b
Add missing methods _capacity for MPMC queue & SPSC queue.
2018-06-27 07:28:34 +02:00
Patrick Pelissier
08f44845ce
Fix issue for SPSC queue:
...
computing the number of elements in the queue is not reliable enough
as we can get more than than the size of the queue.
2018-04-26 22:41:11 +02:00
Patrick Pelissier
4fbffc4788
Use plain 'unsigned int' instead of 'unsigned long long'
...
for index of SPSC queues. There is no issue as we don't compare
the index, but only substract them.
2018-04-26 22:38:43 +02:00
Patrick Pelissier
8cf4050d3d
Remove uneeded alignment constraint for SPSC queue.
2018-04-26 22:26:30 +02:00
Patrick Pelissier
005207cfd6
Remove a warning in release mode.
2018-04-26 22:05:36 +02:00
Patrick Pelissier
f3de34a62b
Optimization for MPMC queues:
...
* use of atomic_explicit functions to give the memory order we want,
* reduce the size of the index to unsigned int: even if there is an
overflow, it doesn't matter as we don't compare the index with < or >
but with ==.
2018-04-19 22:15:37 +02:00
Patrick Pelissier
ba72e4ebbf
Remove check in protected contract:
...
since there are two mutex now, there are data race when we want to check it.
TODO: Properly separate the contract.
2018-03-17 19:54:59 +01:00
Patrick Pelissier
d82dc196e0
Fix datarace (?) if support for pop deferred has been activated
...
(a rewake of thread may be lost)
2018-03-16 23:55:16 +01:00
Patrick Pelissier
f2b2335080
Fix issue with C++ not supporting passing an int constant value to an unsigned atomic type...
...
I definitely find this disturbing.
2018-03-16 22:59:51 +01:00
Patrick Pelissier
cbb881df86
Fix overwrite branch which has a data race on number.
...
Rewrite it to be simpler & faster and without data race.
2018-03-10 10:13:54 +01:00
Patrick Pelissier
103e5304e8
Use of 2 mutex for buffer:
...
* one for the enqueue
* one for the dequeue
The number of items in the buffer is the only variable which can be accessed
by both at the same time.
This improve the performance of the communication and reduce the possibility
of priority inversion between the producer and the consummer thread.
2018-03-09 21:07:21 +01:00
Patrick Pelissier
65f39ab22e
Optmize the buffer queue:
...
don't broadcast the condition variable if we know that
no thread is waiting for it.
Improve bench test from 700ms to 450ms
2018-03-09 19:15:47 +01:00
Patrick Pelissier
c71613dcfe
Don't display warnings about unused variables in release mode.
2018-02-28 21:05:15 +01:00
Patrick Pelissier
b1443533e0
Update comment
2018-02-27 22:41:11 +01:00
Patrick Pelissier
2da51ea6e9
Remove constraint on size > 0
...
as workers can create a queue of size 0
in mono core system.
2018-02-23 22:12:17 +01:00
Patrick Pelissier
d0e7cc41bf
Add more assertions
2018-02-23 20:40:44 +01:00
Patrick Pelissier
a1e791d1e9
Add queue SPSC
2018-02-23 20:38:51 +01:00
Patrick Pelissier
264249fb8b
Improve queue MPMC contract checking
2018-02-23 20:13:04 +01:00
Patrick Pelissier
646df4f34e
Move aligned cache line constant to commun header.
2018-02-10 08:20:37 +01:00
Patrick Pelissier
210e05f7fc
Update copyright to 2018
2018-01-29 20:28:30 +01:00
Patrick Pelissier
aede0547d3
Optimization: replace a division into a conditional move.
2018-01-12 18:56:01 +01:00
Patrick Pelissier
55332d61fd
Fix data race for buffer in POP_RELEASE mode.
2018-01-12 18:52:34 +01:00
Patrick Pelissier
4f3823bfeb
Add new function _blocking allowing to use
...
runtime behavior of the blocking characteristic of the
buffer regardless on how it has been configured.
2018-01-07 00:07:27 +01:00
Patrick Pelissier
3f7b16c736
If the size is constant (!= 0) when defining the buffer
...
then the array is embedded within the structure rather
than allocated when initialization of the structure
occurs.
2018-01-06 22:57:14 +01:00
Patrick Pelissier
362fbb39d4
Update comments
2018-01-06 21:58:30 +01:00
Patrick Pelissier
2c695526dd
Fix issue with stricter C++ compiler with atomic definition.
...
(It still feels strange to not be able to store 0 in an atomic unsigned long).
2017-12-30 12:17:55 +01:00
Patrick Pelissier
2c6f37aa5f
Add QUEUE MPMC contract.
2017-12-30 01:27:22 +01:00
Patrick Pelissier
a74605088e
Fix issue in case of atomic types being with lock
...
(const atomic_ type is invalid).
2017-12-28 12:00:03 +01:00
Patrick Pelissier
31820e7a5d
Fix data race
2017-12-25 23:35:04 +01:00
Patrick Pelissier
a71b0f1076
Fix issue for new option pop_release
2017-12-04 21:29:01 +01:00
Patrick Pelissier
1cadf702cd
Add deferred pop release, so that we won't consider the queue as free
...
until the user code finished handling with the data?
2017-12-02 17:40:50 +01:00
Patrick Pelissier
9f2056468d
Add buffer capacity
2017-12-01 22:46:09 +01:00
Patrick Pelissier
8cab91933f
Separate blocking push & pop.
2017-11-29 22:38:54 +01:00
Patrick Pelissier
cefa0ac589
Minor fix
2017-10-22 22:50:36 +02:00
Patrick Pelissier
aaa8efb6e3
Add policy INIT_MOVE for queue MPMC.
2017-10-22 22:49:25 +02:00
Patrick Pelissier
eed1579f76
Fix issue with C++
2017-10-04 22:11:58 +02:00
Patrick Pelissier
669ba3d8b1
Fix warnings.
2017-10-04 21:50:08 +02:00
Patrick Pelissier
a0948ed11a
Fix a datarace detected by thread sanitizer.
2017-09-30 19:34:34 +02:00