mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
ConcurrentQueueTest::randomCalls() built in Debug mode often crashes when concurrent_queue_test.cpp is modified and ConcurrentQueueTest is launched from Qt Creator so that the test is built and immediately run. The crash is an assertion failure that occurs most of the time under the described circumstances at different test data rows: void YACReader::ConcurrentQueue::finalizeJobs(int): Assertion `jobsLeft >= count' failed. The assertion fails because ConcurrentQueue::enqueue() adds a job into the queue first and then increments jobsLeft. If the job is immediately picked up and executed very fast, ConcurrentQueue::nextJob() can try to finalize it before enqueue() increments jobsLeft. Simply reordering the modifications of jobsLeft and _queue in enqueue() ensures that jobsLeft is always non-negative and eliminates the assertion failures. Note that ConcurrentQueue::finalizeJobs() is the only other function that modifies (decreases) jobsLeft. finalizeJobs() is always called *after* the queue's size is reduced. So the following invariant is now maintained at all times and documented: jobsLeft >= _queue.size(). |
||
---|---|---|
.. | ||
gl | ||
bookmarks.cpp | ||
bookmarks.h | ||
check_new_version.cpp | ||
check_new_version.h | ||
comic_db.cpp | ||
comic_db.h | ||
comic.cpp | ||
comic.h | ||
concurrent_queue.h | ||
custom_widgets.cpp | ||
custom_widgets.h | ||
exit_check.cpp | ||
exit_check.h | ||
folder.cpp | ||
folder.h | ||
http_worker.cpp | ||
http_worker.h | ||
library_item.cpp | ||
library_item.h | ||
onstart_flow_selection_dialog.cpp | ||
onstart_flow_selection_dialog.h | ||
opengl_checker.cpp | ||
opengl_checker.h | ||
pdf_comic.cpp | ||
pdf_comic.h | ||
pdf_comic.mm | ||
pictureflow.cpp | ||
pictureflow.h | ||
qnaturalsorting.cpp | ||
qnaturalsorting.h | ||
release_acquire_atomic.h | ||
scroll_management.cpp | ||
scroll_management.h | ||
worker_thread.h | ||
yacreader_global_gui.cpp | ||
yacreader_global_gui.h | ||
yacreader_global.cpp | ||
yacreader_global.h |