58 Commits
Author SHA1 Message Date
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
Patrick Pelissier e9e7648bcd Add problem to solve detected by sanitiser. 2017-09-27 23:20:10 +02:00
Patrick Pelissier d19a5ad9de Fix warnings.
Update interface to avoid silent cast from size_t to unsigned int.
2017-09-24 23:05:46 +02:00
Patrick Pelissier 2e564088b0 Simplify the inclusion of headers. 2017-09-16 10:14:45 +02:00
Patrick Pelissier 1930bdeac1 _DEF macros checks if a global oplist is register if there is no one
given in the macro call. If it founds one, it will be it instead
of M_DEFAULT_OPLIST.
2017-09-16 08:31:22 +02:00
Patrick Pelissier 67b690bac8 Update comment. 2017-09-14 23:05:51 +02:00
Patrick Pelissier 392835463c Fix issues with new queue. 2017-09-02 22:16:47 +02:00
Patrick Pelissier 4e9375046f Update comment 2017-09-02 19:11:29 +02:00
Patrick Pelissier ae74bde7c9 WIP 2017-09-02 18:20:46 +02:00
Patrick Pelissier ec41f87f97 Add prototype for fast non locking queue MPMC 2017-09-02 18:15:00 +02:00
Patrick Pelissier b802d830b9 Add assertion. 2017-08-26 09:09:30 +02:00
Patrick Pelissier a69c67e850 Remove buffer prefix from buffers.
See commit on shared pointer.
2017-07-25 22:52:19 +02:00
Patrick Pelissier 38c15cebe2 Add statistics about how much overwrite has been done by the buffer.
Unlikley the test about overwrite.
2017-07-19 22:46:53 +02:00
Patrick Pelissier b241933556 Properly introduce contract for buffers. 2017-07-19 22:38:01 +02:00
Patrick Pelissier 3d9ba5cee4 Add the function buffer_size to return the number of objects in the buffer
waiting to be processed.
2017-07-15 16:38:59 +02:00
Patrick Pelissier 5c35411f43 Update TODO (priority queue needs their own headers). 2017-06-19 21:33:43 +02:00
Patrick Pelissier 1739de33c2 Remove hard dependency of INIT_MOVE operator for buffer. 2017-04-23 22:52:47 +02:00
Patrick Pelissier bc1e9239cc Clean up usage of policy within buffer. 2017-04-23 22:46:51 +02:00
Patrick Pelissier 997601c54a Rename M_C3(buffer_, name,_t) into buffer_t 2017-04-23 18:59:06 +02:00