Funktionen asynchron ausführen – Modernes C++

Nachdem wir im letzen Artikel die Grundlagen von Threads und Multithreading kennengelernt haben, wollen wir uns in diesem Artikel mit asynchronen Funktionen beschäftigen. Dafür hat c++ einem header namens future im Gepäck. Dieser header enthält die Klasse std::future und die Funktion std::async. Wir inkludieren den Header und erstellen eine Funktion, die wir asynchron ausführen wollen.…

Einführung in Multithreading – Modernes C++

Was ist multithreading? Multithreading ist die Fähigkeit eines Prozessors, mehrere Threads gleichzeitig auszuführen. Ein Thread ist ein Pfad der Ausführung, der es einem Prozessor ermöglicht, mehrere Aufgaben gleichzeitig auszuführen. Die meisten Prozessoren können mehrere Threads gleichzeitig ausführen. Beispiel mit einem (zusätzlichem) Thread In diesem Beispiel wird ein zusätzlicher Thread gestartet, der eine Funktion ausführt. Um…

How to test your code on multiple platforms with nox

Motivation Maintaining python packages for more than one python version can be a bit of a hassle In https://creatronix.de/how-to-use-tox-to-test-your-code-on-multiple-platforms/ I’ve introduced tox. An interesting alternative is nox(!) due to its programmatic approach Installation pip install nox Example Linting Let’s take a minimum viable example. In our main.py we intentionally omit the newline at the end…

Pillow how to convert images to webp

Motivation WebP is a modern image format that provides superior lossless and lossy compression for images on the web. It was developed by Google, and is designed to be smaller in size than other image formats, while still maintaining high image quality. One reason WebP is often considered better than JPEG is that it can…