Go to file
Igor Kushnir cb7c967252 Add WorkerThread class and use it in ComicFlow
In a later commit WorkerThread should also replace classes similar to
ImageLoader: PageLoader, ImageLoaderGL and ImageLoaderByteArrayGL.

Bugs fixed:
  1. Eliminated a data race between ImageLoader::run() and
ComicFlow::updateImageData()->ImageLoader::result(). Specifically when
ImageLoader::busy() returns false, then ImageLoader::run() sets
ImageLoader::working to true, loads the image and starts assigning it to
ImageLoader::img, while ImageLoader::result() is accessed without
locking from updateImageData().
Making ImageLoader::working atomic is clearly insufficient to eliminate
this data race. The fix is to set 'working' to true immediately and
synchronously as soon as a new task is assigned to the worker.
  2. Replaced thread termination with graceful thread exit. ComicFlow
destructor called QThread::terminate(), using which is discouraged by Qt
documentation. The application exited without errors in Release mode.
In Debug mode, however, it received the SIG32 signal on exit and printed
the following warning - "QWaitCondition: mutex destroy failure:
Device or resource busy".
The loop in WorkerThread::run() is no longer endless. The worker thread
properly ends and is joined in WorkerThread destructor.

Design decisions:
 1. WorkerThread could emit a signal when it completes a task.
Thus updateTimer could be removed from ComicFlow and GoToFlow. However,
there is no obvious way to use this new signal in the two GL classes.
Also I don't know whether updateTimer is just an inefficient polling
substitute for notification or an intentional animation mechanism.
 2. The index variable is no longer stored in the worker class, but in
ComicFlow directly. Thing is, this data member was never actually
accessed by the worker, but ComicFlow went so far as to lock worker's
mutex to "protect" access to the index.
 3. The common ImageLoader implementation turned out to be very general.
So I converted it into the WorkerThread class template that is not
restricted to producing QImage results and can be reused elsewhere.
 4. I used standard classes (such as std::thread) instead of their Qt
equivalents (e.g. QThread) because they are more thoroughly documented.
The standard classes should also be more efficient as they were more
carefully designed and provide much fewer unnecessary features.
 5. Release-Acquire ordering is safe for the WorkerThread::working
use case and is more efficient than the std::atomic-default
Sequentially-consistent ordering.
 6. condition.notify_one() is called while the mutex is unlocked
to improve performance. This is safe in both cases:
  a) if the worker thread exits due to a spurious wakeup just before
the condition.notify_one() call in WorkerThread destructor, so much the
better;
  b) if a spurious wakeup lets the worker thread finish the task and
start waiting on the condition again just before the
condition.notify_one() call in WorkerThread::performTask(), the second
waking will be ignored by the worker thread as 'working' and 'abort'
will be false then.
2020-08-31 15:45:12 +02:00
ci/win Update openssl binaries 2019-09-25 16:22:15 +02:00
common Add WorkerThread class and use it in ComicFlow 2020-08-31 15:45:12 +02:00
compressed_archive Fix code format errors due to changes in default coding style. (#150) 2020-07-24 21:17:49 +02:00
custom_widgets Fix code format errors due to changes in default coding style. (#150) 2020-07-24 21:17:49 +02:00
dependencies Use pdfkit by default in macos 2019-09-27 18:32:34 +02:00
files Use the build number in code 2019-08-24 11:11:55 +02:00
images Headless server: simplify system config logger 2018-01-28 13:32:56 +01:00
release Update server code integration for QtWebApp 1.7.11 2020-08-20 18:22:57 +02:00
shortcuts_management Add new action to create a new instance of the viewer in macos 2019-09-28 16:55:28 +02:00
tests/compressed_archive_test Format code using clang-format 2019-05-30 19:46:37 +02:00
third_party Add QtWebApp to third party readme 2020-08-20 18:22:57 +02:00
YACReader Reader: fix QTimer-related memory leaks 2020-08-31 15:44:50 +02:00
YACReaderLibrary Add WorkerThread class and use it in ComicFlow 2020-08-31 15:45:12 +02:00
YACReaderLibraryServer Headless server: Add support for setting a port from commandline 2020-08-29 18:21:06 +02:00
.clang-format Remove comment pragmas 2019-05-31 19:43:54 +02:00
.editorconfig Add .editorconfig to prevent whitespace conflicts 2019-04-19 15:02:34 +00:00
.gitattributes Exclude openssl an 7zip from git export so they don't pollute our source tarballs 2020-04-11 21:26:19 +02:00
.gitignore Update gitignore 2019-08-24 11:11:50 +02:00
azure-pipelines-build-number.yml Properly date+revision calculation 2019-08-24 11:11:57 +02:00
azure-pipelines-windows-template.yml Install QtScript in Windows 2020-04-09 18:35:01 +02:00
azure-pipelines.yml Skip macos sign on prs 2020-04-11 19:40:52 +02:00
background.png Headless server: simplify system config logger 2018-01-28 13:32:56 +01:00
background@2x.png Add @2x background image for macos dmg 2019-09-01 13:31:54 +02:00
CHANGELOG.md Headless server: Add support for setting a port from commandline 2020-08-29 18:21:06 +02:00
cleanOSX.sh Headless server: simplify system config logger 2018-01-28 13:32:56 +01:00
compileOSX.sh Keep track about codesign in the logs 2019-09-18 23:26:13 +02:00
config.pri Use pdfkit by default in macos 2019-09-27 18:32:34 +02:00
COPYING.txt Headless server: simplify system config logger 2018-01-28 13:32:56 +01:00
dmg.json Volume name was too large 2019-09-01 13:31:36 +02:00
icon.icns Headless server: simplify system config logger 2018-01-28 13:32:56 +01:00
INSTALL.md Update docs a little bit 2019-09-23 12:13:56 +02:00
mktarball.sh Update mktarball.sh for git usage (needs .gitattributes). 2018-06-06 13:46:24 +02:00
README.md fix spelling error in readme.md (#142) 2020-07-02 20:23:44 +02:00
signapps.sh Keep track about codesign in the logs 2019-09-18 23:26:13 +02:00
YACReader.1 Headless server: simplify system config logger 2018-01-28 13:32:56 +01:00
YACReader.desktop Headless server: simplify system config logger 2018-01-28 13:32:56 +01:00
YACReader.pro Add YACReaderLibraryServer to YACReader.pro 2019-08-24 11:11:53 +02:00
YACReader.svg Headless server: simplify system config logger 2018-01-28 13:32:56 +01:00
YACReaderLibrary.1 Headless server: simplify system config logger 2018-01-28 13:32:56 +01:00
YACReaderLibrary.desktop Headless server: simplify system config logger 2018-01-28 13:32:56 +01:00
YACReaderLibrary.svg Headless server: simplify system config logger 2018-01-28 13:32:56 +01:00

Build Master Develop
Code Validation Build Status Build Status
Linux Build Status Build Status
Windows x86 Build Status Build Status
Windows x64 Build Status Build Status
MacOS Build Status Build Status
Publish Build Build Status

YACReader

"Yet another comic reader"

License

This software has been developed by Luis Ángel San Martín Rodríguez (luisangelsm@gmail.com) under GPL v3 license (see COPYING.txt).

Getting YACReader

Official releases:

https://github.com/YACReader/yacreader/releases

As a package:

Packaging status

From OBS build service:

Building from source:

See INSTALL.md

Contact

If you need help or have any suggestion, please, send me an e-mail.

Contributing

If you are interested in contributing to the project the first step should be to contact me so we can plan together the best approach, you can send an e-mail or just open an issue in this repo. For small bug fixes it is usually ok to open a PR directly.

Contributions are not restricted to code, you can help the project by bringing new UI/UX ideas, designing new assets, writing manuals or tutorials, translating the apps, etc. If you are interested in DevOps, YACReader uses Azure Pipelines for CI/CD, any improvements in that area are welcome. Testing pre-releases is also really appreciated.

Code

YACReader uses clang-format to ensure a common style and avoid deviances from it. CI checks this and will fail if the correct format is not used. clang-format needs to be called recursively in all the folders because some of them have the own .clang-format file, mainly to exclude changing the format in third-party libraries which are included in the source code. I recommend to configure your development tools to use clang-format, you can try to use it manually, but please, do it always before committing changes. I recommend using QtCreator configured properly, you can find a tutorial here.

CI/CD

Any PR will be validated through CI, and it will not be merged if CI fails.

Pull Requests

The base and target branch for any PR should always be develop.

Donations

YACReader is free but it needs money to keep being alive, so please, if you like YACReader, visit the home page and make a donation.