RUVIDEO
Поделитесь видео 🙏

Live C++ coding: adding and testing threadsafe::UnlockedBase

📁 Обучение 👁️ 16 📅 03.12.2023

Please switch manually to HD if required (youtube doesn't always do that, even when possible).

Current stream:
Back to https://github.com/CarloWood/cppgraphviz-testsuite (a testsuite for https://github.com/CarloWood/cppgraphviz). I was working on making this thread-safe, which meant replacing certain types with `threadsafe::Unlocked` types (from https://github.com/CarloWood/threadsafe) and then fixing all compile errors.

The main thing that I changed is changing `ConstItemPtr::shared_item_ptr_` from `boost::intrusive_ptr⟨Item⟩` to `Item::unlocked_type` aka `threadsafe::ConstUnlockedBase⟨Item, ItemLockingPolicy⟩` where the latter is also incrementing the ref count on `Item` but requires a mutex to be locked before the underlying Item can be accessed. This "automatically" leads to compile errors whereever locking that mutex is required for threadsafety... and that were, and still are, a LOT of places.

One of the things that has the most impact the fact that I removed `operator-⟩()` from `ItemPtrTemplate⟨⟩`. That operator previously returned the underlying `Item*` as stored by the above `boost::intrusive_ptr`, but casted back to the derived class of the read item type (derived from Item). We can't do that anymore because we need to lock a mutex now before accessing such object. This means that code like:

graph_ptr-⟩add(foo);

that was using that operator-⟩, now needs to be rewritten as

dot::GraphPtr::unlocked_type::wat{graph_ptr_.item()}-⟩add(foo);

That is, creating a temporary Write-Access-Type whose creation locks the mutex and gives access to the underlying `dot::GraphItem`.

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Live C++ coding: adding and testing threadsafe::UnlockedBase», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.