Commit Graph

18 Commits

Author SHA1 Message Date
Bartosz Taudul
7a6564feae Only recycle producers, if there's no data in queue.
("The queue" is per-thread partial queue here.)

This fixes a problem where one thread writes to the queue, then is
terminated, making the (partially filled) queue available for other
threads to recycle. If another thread re-owns the queue, it will change
the associated thread id, while part of the queue was filled by the
original thread. This obviously created invalid data during dequeue.

The fix makes the recycling process check not only for queue inactivity
(which is marked when the original thread terminates), but also if the
queue is empty, preventing mixing data from different threads.
2019-08-30 14:28:44 +02:00
Bartosz Taudul
ca3571fd2b Still more. 2019-07-30 01:30:31 +02:00
Bartosz Taudul
47423e6263 And more. 2019-07-30 01:29:13 +02:00
Bartosz Taudul
d3783ae359 Remove magic template syntax. 2019-07-30 01:28:21 +02:00
Bartosz Taudul
c7f769c52b Allow dequeuing from a single producer, retrieving thread id. 2019-07-29 23:29:30 +02:00
Bartosz Taudul
6cad76ae67 Store thread id in queue producer. 2019-07-29 23:13:06 +02:00
Bartosz Taudul
7ae9a28e32 Drop BlockingConcurrentQueue. 2019-07-29 22:58:13 +02:00
Bartosz Taudul
480a427e07 No need to hash thread ids anymore. 2019-07-29 22:36:04 +02:00
Bartosz Taudul
c60af95053 Remove unused const. 2019-07-29 22:33:32 +02:00
Bartosz Taudul
2d42abf552 Remove CannoAlloc functions. 2019-07-29 22:31:32 +02:00
Bartosz Taudul
b142860c8d More implicit producer removal. 2019-07-29 22:29:39 +02:00
Bartosz Taudul
db6eceb1a6 Producers must be explicit. 2019-07-29 22:25:28 +02:00
Bartosz Taudul
89928fde7b Queue must be always able to alloc. 2019-07-29 22:13:16 +02:00
Bartosz Taudul
a03734afa6 Remove more debug code. 2019-07-29 22:01:06 +02:00
Bartosz Taudul
e9a0145cd5 Remove MCDBGQ_NOLOCKFREE_IMPLICITPRODBLOCKINDEX. 2019-07-29 21:56:53 +02:00
Bartosz Taudul
b496f1ff90 Remove MOODYCAMEL_QUEUE_INTERNAL_DEBUG. 2019-07-29 21:52:49 +02:00
Bartosz Taudul
beaadc3a56 Remove always disabled MCDBGQ_TRACKMEM code. 2019-07-29 21:51:29 +02:00
Bartosz Taudul
82a4a6d9cc Add tracy_ prefix to concurrentqueue.h file name. 2019-07-29 21:47:50 +02:00