Mutex + Lock = CsLibGuarded

  Рет қаралды 2,230

CopperSpice

CopperSpice

Күн бұрын

Пікірлер: 24
@Bob-tu9jq
@Bob-tu9jq 3 жыл бұрын
Aside from your professional content, people are aware of your awesome English pronunciations. Your voices and tones are very good. 👍🏻
@saulth
@saulth 3 жыл бұрын
Great, I made something just like this a few years back and it's been very nice to use, takes away many opportunities to fail. I like your implementations better, thanks 😁
@jonkalb2746
@jonkalb2746 3 жыл бұрын
What a great library. Tell me again why it isn’t in Boost?
@CopperSpice
@CopperSpice 3 жыл бұрын
Glad to help you make this happen.
@267praveen
@267praveen 2 жыл бұрын
@@CopperSpice you didn't answer his question
@CopperSpice
@CopperSpice 2 жыл бұрын
@@267praveen, his comment was actually an inside joke. Jon offered to submit this to Boost a few years ago and has yet to make it happen. We are happy to support anyone who would like to pursue this endeavor.
@KayFiiya
@KayFiiya 3 жыл бұрын
Please share videos about how to use CopperSpice to build guis in c++
@skarndev488
@skarndev488 3 жыл бұрын
Awesome simplification for the use of threading! Does CsLibGuarded allow sharing a singular internal mutex for multiple objects to avoid lock overhead?
@CopperSpice
@CopperSpice 3 жыл бұрын
I believe what you are asking is how to "guard" multiple pieces of data using the same mutex. The best approach to solve this is to place your data objects in a single structure. Then using the struct as the data type for the guarded variable. This is a really cool use case.
@NoNameAtAll2
@NoNameAtAll2 3 жыл бұрын
Why doesn't such a respectable channel use universal initialisation at slide at 4:10?
@CopperSpice
@CopperSpice 3 жыл бұрын
As a correction, there is nothing in the standard called "universal initialization." This is a common misconception. There are several different forms of initialization which use braces, such as direct initialization, default initialization, zero initialization, and aggregate initialization. Some of these have interesting corner cases. We write our examples to highlight the current topic rather than teaching multiple things at once.
@VishalSharma-ys9wt
@VishalSharma-ys9wt 3 жыл бұрын
I felt like "data race" would've been the more appropriate term instead of "race condition" at some places in the video.
@kormisha
@kormisha 2 жыл бұрын
In lr_gurded class, updating write value does not need to block the readers but would not updating the read value have to block the readers?
@CopperSpice
@CopperSpice 2 жыл бұрын
In the lr_guarded class the two values are called "left" and "right". Can you tell me what you are referring to by the "write" and the "read" value?
@kormisha
@kormisha 2 жыл бұрын
@@CopperSpice as per the video, the write value is the one that gets updated with the mutex. The read value is the one consumed by the threads and the video says no mutex is needed as only read operations are performed. But I do not understand how you keep both values in sync without locking both at some time.
@CopperSpice
@CopperSpice 2 жыл бұрын
Thanks, now we understand your question. Let me give you an example of how the lr_guarded algorithm works. If the left value is currently being read then the right value can be updated by the writer. After the right value is updated, internal pointers are updated so new readers start reading the right value. After all old readers have completed, the left value is then updated to match the right value and this can be done without a lock. This writer may have to wait a long time for all old readers to finish. If you have other comments or questions please feel free to ask. This discussion added a lot to the video.
@wizardy6267
@wizardy6267 3 жыл бұрын
Another nice video
@CopperSpice
@CopperSpice 3 жыл бұрын
Glad you liked the video.
@NoNameAtAll2
@NoNameAtAll2 3 жыл бұрын
This lib reminds me of rust's "mutex" type, but slightly better. Glad it came to c++
@CopperSpice
@CopperSpice 3 жыл бұрын
The initial release for CsLibGuarded was about 5 years ago. We have other videos which talk about the internals, this was our first "how to use" it.
@manuelm.8364
@manuelm.8364 3 жыл бұрын
The Github link doesn't work. But the video is very interesting.
@CopperSpice
@CopperSpice 3 жыл бұрын
Here is the exact link to the source code for CsLibGuarded. github.com/copperspice/cs_libguarded
@manuelm.8364
@manuelm.8364 3 жыл бұрын
@@CopperSpice Yes, I found it. I thought you may want to fix the link. There is a HTML 404 error.
@CopperSpice
@CopperSpice 3 жыл бұрын
@@manuelm.8364 Oh, your comment was referring to a bug in the youtube link. Seems they damaged the url we supplied. We will get this fixed.
char8_t
16:16
CopperSpice
Рет қаралды 2 М.
how does a Mutex even work? (atoms in the computer??)
4:17
Low Level
Рет қаралды 73 М.
We Attempted The Impossible 😱
00:54
Topper Guild
Рет қаралды 56 МЛН
Paradigms, Polymorphism, and Generic Programming
16:40
CopperSpice
Рет қаралды 1,7 М.
A Deep Dive into JVM Start-Up
22:03
Java
Рет қаралды 21 М.
Auto is Not a Data Type
16:54
CopperSpice
Рет қаралды 1,9 М.
Safety and Speed Issues with Threads. (pthreads, mutex, locks)
9:13
Netflix Removed React?
20:36
Theo - t3․gg
Рет қаралды 70 М.
Is Virtual of Value
13:37
CopperSpice
Рет қаралды 1,5 М.
Observations about the C++ Standard library
16:33
CopperSpice
Рет қаралды 2,2 М.
The Return of Procedural Programming - Richard Feldman
52:53
ChariotSolutions
Рет қаралды 61 М.
Static Things
10:15
CopperSpice
Рет қаралды 1,6 М.
7 Outside The Box Puzzles
12:16
MindYourDecisions
Рет қаралды 205 М.
Американцы красят асфальт?
0:27
BAZAR CLUB
Рет қаралды 188 М.
Do YOU Understand WHAT JUST HAPPENED!? 😂 #shorts
0:57
LankyBox World
Рет қаралды 1,6 МЛН
BIP HOUSE  .бип хаус 🥰🏡  #shorts
0:13
bip_house
Рет қаралды 1,2 МЛН
🪄Вечная спичка #diy #выживание #поход
1:00
Короче, ВИ
Рет қаралды 2,8 МЛН
Её автомобиль никто не хотел ремонтировать!
20:12
Гараж Автоэлектрика
Рет қаралды 1,5 МЛН