No video

Singleton Design Pattern | Implementation with details & code ✌🏻

  Рет қаралды 60,053

Keerti Purswani

Keerti Purswani

Күн бұрын

Really really wanted my first KZfaq video this year to be a Tutorial! It’s a symbol that this year is going to be filled with a LOT of tutorials - starting with finishing 𝐃𝐞𝐬𝐢𝐠𝐧 𝐏𝐚𝐭𝐭𝐞𝐫𝐧 𝐒𝐞𝐫𝐢𝐞𝐬.
Today’s video is on 𝐒𝐢𝐧𝐠𝐥𝐞𝐭𝐨𝐧 𝐃𝐞𝐬𝐢𝐠𝐧 𝐏𝐚𝐭𝐭𝐞𝐫𝐧. I know most people think they know this design pattern as it’s a basic and common one, but there are details to it that we end up missing. Making the code thread safe and efficient is important when it comes to implementing the code.
So, obviously. I have covered everything with code in detail. Link is in comments. Please keep sharing your feedback.
If you guys really want educators to be motivated and create a lot of tutorials, please do support us - just a like, share or subscribe can mean a lot to us. Trust me - a LOT of effort goes behind these videos!
𝐂𝐡𝐞𝐜𝐤 𝐨𝐮𝐭 𝐄𝐝𝐮𝐜𝐚𝐭𝐢𝐯𝐞 𝐡𝐞𝐫𝐞-
educative.io/keerti
Educative Unlimited-
Educative.io/unlimited
You can get 𝐃𝐈𝐒𝐂𝐎𝐔𝐍𝐓𝐒 using code "KEERTI" -
➡️ On 𝐂𝐨𝐝𝐢𝐧𝐠 𝐍𝐢𝐧𝐣𝐚𝐬 - bit.ly/CodingNinjas-12
➡️ On 𝐈𝐧𝐭𝐞𝐫𝐯𝐢𝐞𝐰𝐑𝐞𝐚𝐝𝐲 - get.interviewready.io/?_aff=K...
➡️ On 𝐄𝐝𝐮𝐜𝐚𝐭𝐢𝐯𝐞 - educative.io/keerti
➡️ On all 𝐆𝐞𝐞𝐤𝐬𝐅𝐨𝐫𝐆𝐞𝐞𝐤𝐬 paid courses - practice.geeksforgeeks.org/co...
Please 𝐬𝐮𝐛𝐬𝐜𝐫𝐢𝐛𝐞 here - / keertipurswani
You can also connect with me on-
𝐈𝐧𝐬𝐭𝐚𝐠𝐫𝐚𝐦 (for not so professional, chill side of my life) - keerti.purs...
𝐓𝐞𝐥𝐞𝐠𝐫𝐚𝐦 Channel - t.me/keertipurswani
𝐓𝐰𝐢𝐭𝐭𝐞𝐫 - KeertiPurswani?s=09
𝐋𝐢𝐧𝐤𝐞𝐝𝐈𝐧 - / keertipurswani
𝐂𝐡𝐞𝐜𝐤 𝐨𝐮𝐭 𝐭𝐡𝐞𝐬𝐞 𝐩𝐥𝐚𝐲𝐥𝐢𝐬𝐭𝐬-
𝐌𝐨𝐜𝐤 𝐈𝐧𝐭𝐞𝐫𝐯𝐢𝐞𝐰𝐬 - • Mock Coding Interview ...
𝐃𝐞𝐬𝐢𝐠𝐧 𝐏𝐚𝐭𝐭𝐞𝐫𝐧𝐬 -
• Intro to Design Patter...
𝐃𝐒𝐀 - • Median of 2 Sorted Arr...
𝐃𝐲𝐧𝐚𝐦𝐢𝐜 𝐏𝐫𝐨𝐠𝐫𝐚𝐦𝐦𝐢𝐧𝐠 - • Burst Balloon Problem ...
𝐇𝐨𝐧𝐞𝐬𝐭 𝐂𝐨𝐧𝐯𝐞𝐫𝐬𝐚𝐭𝐢𝐨𝐧𝐬 -
• Meet Hiring Manager at...
𝐂++ - • VTable & VPointers - V...
𝐁𝐚𝐬𝐢𝐜𝐬 𝐨𝐟 𝐈𝐧𝐯𝐞𝐬𝐭𝐦𝐞𝐧𝐭𝐬 - • What are IPOs? How to ...
𝐋𝐢𝐟𝐞 𝐚𝐭 𝐈𝐧𝐭𝐮𝐢𝐭 - • Meet my Manager at Int...
𝐒𝐡𝐨𝐫𝐭𝐬 - • Floor, Ceil use for Pr...
𝐂++ 𝐒𝐓𝐋 - • What is C++ STL? Why d...
𝐓𝐫𝐞𝐞𝐬 & 𝐆𝐫𝐚𝐩𝐡𝐬 - • BFS, DFS|Explanation w...
𝐖𝐢𝐭𝐡 𝐏𝐚𝐩𝐚 - • Explaining OOPs concep...
𝐒𝐲𝐬𝐭𝐞𝐦 𝐃𝐞𝐬𝐢𝐠𝐧 - • Factory Design Pattern...
𝐏𝐚𝐢𝐧𝐭𝐢𝐧𝐠𝐬 - • Wall Art | SwitchBoard...
𝐕𝐥𝐨𝐠𝐬 - • Best Ladakh Bike Trip ...
The video contains following parts-
0:00-1:45 - Intro of Singleton Design Pattern
1:45-2:08 - Educative Promotion
2:08-4:45 - Simple Logger Class Code
4:45-6:33 - Count instances of Logger
6:33-7:25 - Restrict Logger Instantiation
7:25-11:52 - Simple Singleton Implementation
11:52-15:32 - Code fails in MultiThreading Case
15:32-17:20 - Thread Safe Singleton
17:20-19:03 - Double-checked Locking
19:03-20:15 - Points to keep in mind!
#designpatterns #singleton #systemdesign #softwareengineering

Пікірлер: 139
@arjungupta250
@arjungupta250 2 жыл бұрын
Thanks a ton Keerti! Such an awesome video including the multithreading handling part which was unexpected, and while learning I enjoyed it throughly. Paused the video in between to like it because this video and this design pattern series deserves it. Looking forward for next videos in the series :D
@KeertiPurswani
@KeertiPurswani 2 жыл бұрын
Thank you so much. Sorry for releasing the rest of the series late but finishing it soon ❤️😇
@vaibhavjain8672
@vaibhavjain8672 3 ай бұрын
Thanks a lot, Keerti. I am fresher and was super scared when I first check what it is online, but you made it super simple that even a fresher who barely knows these concepts in detail can understand it. Super happy learning this in such a simple way.
@pratikwadekar4981
@pratikwadekar4981 2 жыл бұрын
Hey Keerti, This was really great explanation. Most videos would stop showing the implementation about singleton design pattern. But the fact that you showed how to make them thread safe was a cherry on top. One request though, could you increase the font size or zoom in into your code editor in upcoming videos as it becomes difficult when viewing on phone.
@KeertiPurswani
@KeertiPurswani 2 жыл бұрын
Thanks Pratik. Will definitely increase more from next time😇 Feedback like yours helps me improve in every video❤️😇
@aryanyadav3926
@aryanyadav3926 Жыл бұрын
Once we have checked that loggerInstance==nullptr, why is there a need to check it again, can't we just apply the lock and create a new loggerInstance as we know that it is null?
@swatiacharya9073
@swatiacharya9073 8 ай бұрын
I use to always skip the design pattern concepts..but with your videos...its so easy to understand...i look forward to other videos... great work thanks for sharing the knowledge wirh us...😍
@RohitRaj-qv5nq
@RohitRaj-qv5nq 2 жыл бұрын
Wonderful explanation Keerti, It is hard to find Oops tutorial in C++ and you have handled it easily. Thanks a lot again.
@KeertiPurswani
@KeertiPurswani Жыл бұрын
Thank you so much! Means a lot! Please do share with your friends! ❤️
@SugamMaheshwari
@SugamMaheshwari 3 ай бұрын
Lovely explanation of double checking before locking for thread-safe single ton logging🔥
@kedarsadhu2816
@kedarsadhu2816 Жыл бұрын
Thanks a lot Keerti. This is the most complete video I have seen so far. I like the way you explain "WHY" we need to do it. Really appreciate your work.
@KeertiPurswani
@KeertiPurswani Жыл бұрын
Thank you so much! Means a lot! Hoping you like rest of the videos as well! ❤️😇
@guruprasad_sannenahalli
@guruprasad_sannenahalli 20 күн бұрын
Thanks Keerti. Very useful.
@PRANAVMAPPOLI
@PRANAVMAPPOLI 11 ай бұрын
Hey, thanks for the awesome explanation. Why we need the 2 if check, cant we remove the inner if check?
@akshayyadav6854
@akshayyadav6854 7 ай бұрын
Have the same question...
@nileshpatil4111
@nileshpatil4111 Ай бұрын
Nicely explained. Understood it completely
@insofcury
@insofcury 3 ай бұрын
Keerti awesome work on the video. I do have a suggestion though. It would be great to if you have have those multiple files in the split window so that it is easily to reference and connect while watching the video itself. This is one way to do it, but the idea is to have visibility or maybe use lesser files. I totally understand that this way it is much more modular but I think for watching everything on a single screen helps better.
@47hriday
@47hriday 2 жыл бұрын
Its best explanation about singleton.Thank You.
@user-ek5jw3cl7k
@user-ek5jw3cl7k 11 ай бұрын
Thank you ma'am. I have a question. If you null pointer check for loggerInstance on Ln. 21 then do you really think null check required on Ln.24 as well
@aloklakhotia7251
@aloklakhotia7251 2 жыл бұрын
Great video. Thanks for this. :D One doubt: Isn't the inner if condition redundant as the lock is already captured?
@KeertiPurswani
@KeertiPurswani 2 жыл бұрын
Thanks Suraj. For explaining so well! ❤️😇
@geeksentertainmentmedia4827
@geeksentertainmentmedia4827 2 жыл бұрын
And "upper if" to just stop "locking" once you have created the instance.
@shashankcool
@shashankcool 2 жыл бұрын
Thanks Keerti for such crisp & nice video capturing all the necessary points related to singleton design pattern. Really appreciate for posting such videos which helps the entire developer community.
@KeertiPurswani
@KeertiPurswani Жыл бұрын
Thank you so much, means a lot! Hoping you will like the new videos as well! 😇
@RaisShaikh-bs7dh
@RaisShaikh-bs7dh Жыл бұрын
Thanks Keerti, Such a great video including each smaller things in it. One request if you can give one session on only mutex and semaphore will help us a lot. Thank you so much again for this wonderful session.
@KeertiPurswani
@KeertiPurswani Жыл бұрын
Will do for sure!
@SourabhDesaiBrief
@SourabhDesaiBrief Жыл бұрын
Clearly Visible, Thank You :) It complied on first time, on staging code - Truly magical!
@KeertiPurswani
@KeertiPurswani Жыл бұрын
Thank you! A lot of effort goes behind every single video! ❤️
@venkatkrishna3774
@venkatkrishna3774 2 жыл бұрын
Please increase the font size when you write code or zoom in a bit. Difficult to read from distance. Thanks
@mayankrai7938
@mayankrai7938 2 жыл бұрын
Finally back ☺️
@KeertiPurswani
@KeertiPurswani 2 жыл бұрын
With many many videos this time❤️😇
@sivakumardugana3272
@sivakumardugana3272 11 ай бұрын
Very clear explanation with examples. Thanks Kreeti
@whynesspower
@whynesspower 10 ай бұрын
To restrict access to the operator=, you can declare it as private in the class definition, as you've already done. However, you should also provide an empty definition for it to make it inaccessible and avoid compilation errors. Here's how you can do it: cpp code private: Logger& operator=(const Logger&) = delete; Adding = delete explicitly specifies that the copy assignment operator is deleted and cannot be used. This way, any attempt to use the copy assignment operator will result in a compilation error
@mayankprabhakar5336
@mayankprabhakar5336 Жыл бұрын
Thanks for such a simple explanation!! I have one Q. Should I also delete "move constructor" & "move assignment operator" in singleton class? If YES or No, explanation would be very helpful.
@AdityaNakhare
@AdityaNakhare 2 жыл бұрын
In a main method, you can create a singleton class instance before creating a thread. There won't be any contention issue, locking is also not needed.
@user-xr6qq9gf4o
@user-xr6qq9gf4o Жыл бұрын
Thanks Keerti! Very good way of explanation. God bless you.
@theSDE2
@theSDE2 2 жыл бұрын
keerti please do a parallel code for java as well.
@bheemsenkulkarni2471
@bheemsenkulkarni2471 Жыл бұрын
Thanks Keerthi, this was a very good explanation about singleton
@Ww-ul8oe
@Ww-ul8oe 2 жыл бұрын
Thank you Keerti. Appreciate implementing in c++
@KeertiPurswani
@KeertiPurswani Жыл бұрын
Thank you! Please do subscribe and share the video with your friends❤️😇
@durgeshrai04
@durgeshrai04 Жыл бұрын
Thanks a lot Kreerti! for the wonderful explantion of singleton design pattern.
@KeertiPurswani
@KeertiPurswani Жыл бұрын
Thank you! Hope you like other videos on the channel as well! 😇
@mohanganesh1055
@mohanganesh1055 2 жыл бұрын
Mam, please complete the design pattern playlist as fast as possible.
@VY-zt3ph
@VY-zt3ph 2 жыл бұрын
Fantastic video. I came here after hearing your interview experience. I learned MULTITHREADING just to understand this video.
@KeertiPurswani
@KeertiPurswani Жыл бұрын
Woah! How awesome is that! ❤️😇
@VY-zt3ph
@VY-zt3ph Жыл бұрын
@@KeertiPurswani Thank you Di
@tarunkumar7656
@tarunkumar7656 2 ай бұрын
AWESOME, Great work!
@vipulpurbey4323
@vipulpurbey4323 Жыл бұрын
goldmine of a video
@virendramane7818
@virendramane7818 7 ай бұрын
Thank you Keerti! Really appreciate your work.
@AnkitaSingh-vv5rc
@AnkitaSingh-vv5rc Ай бұрын
Thankyou so much, Keerti Mam
@roushanraj8530
@roushanraj8530 2 жыл бұрын
Thank you very much Di, got this from end to end like thread safe and all.... One doubt why we use .hpp and .cpp files both..... we can't do in .cpp file only, its little bit confusing to me, i haven't code like this in cpp And please add more videos.... this Playlist is going to be best on KZfaq for LLD and system design 💯💯
@nehakale9427
@nehakale9427 10 ай бұрын
Excellent explaination Keerti!
@osamayounus4867
@osamayounus4867 2 жыл бұрын
Thanks for these videos. One thing which would help with visibility is if you can show all open code files side by side
@KeertiPurswani
@KeertiPurswani Жыл бұрын
But you won’t be able to see the code clearly on screen. I am going to upload all to github pretty soon!
@ritikapande21
@ritikapande21 2 жыл бұрын
Hey Keerti, Really a good video and detailed explanation. Hats off and please continue to contribute.
@KeertiPurswani
@KeertiPurswani 2 жыл бұрын
Thank you so much Ritika, means a lot! More videos coming up soon ❤️😇
@sohelsheikh1934
@sohelsheikh1934 2 жыл бұрын
For Java People, to handle multithreading do below changes in Logger class - public static Logger getLogger() { if(logger == null) { logger = getInstance(); } return logger; } synchronized public static Logger getInstance(){ if(logger == null) return new Logger(); else return logger; }
@krishnasummer5603
@krishnasummer5603 Жыл бұрын
Hi sis, your explanation is very clean & good, if u can add more design patterns .It'll be a great help. Thanks.
@rahulsagarvoduru5158
@rahulsagarvoduru5158 2 жыл бұрын
You are a great teacher !! Thank You !!
@j.r.krishna1122
@j.r.krishna1122 Жыл бұрын
You made my day
@PkSam07
@PkSam07 Жыл бұрын
Awesome explanation! but I think you missed to explain why we should go for singleton pattern? I think you mentioned in order to avoid multiple logs in different places? I didn't get that?
@rosansenapati-pl5hr
@rosansenapati-pl5hr Жыл бұрын
wonderful explanation thank you so much for teaching us
@KeertiPurswani
@KeertiPurswani Жыл бұрын
Thank you! Please do share the video with your friends!
@rosansenapati-pl5hr
@rosansenapati-pl5hr Жыл бұрын
@@KeertiPurswani ofcourse I will this is great stuffs and people need to know about your amazing videos
@nkjat123
@nkjat123 Жыл бұрын
Hi Guys.. awesome videos
@Kaushikraj9845
@Kaushikraj9845 2 жыл бұрын
Assuming if we write the code in java ..Can we create object during initialization like below public class Singleton { private static Singleton singleton=new Singleton();; private Singleton() { super(); } public static Singleton getSingleton() { return singleton; } }
@arkosnatoneogy2366
@arkosnatoneogy2366 7 ай бұрын
after you implement the double checked lock is the inner if condition needed any more? isnt it bound to be TRUE?
@mayurbadwaik6401
@mayurbadwaik6401 Жыл бұрын
wonderfull explantion keerti, one doubt -> as explained to use mutex, can we follow this approach -> run 1st thread and after that remaining threads -> anyways we are just blocking 2 threads to make instances for the first time and after the instance is created it would not matter how many threads access it
@kartheekgoud9009
@kartheekgoud9009 2 жыл бұрын
Thanks Keerthi.. Really great explanation 👏.
@rohit_kapdi
@rohit_kapdi Жыл бұрын
Superb explanation. ❤
@KeertiPurswani
@KeertiPurswani Жыл бұрын
Thank you! Hope you like other videos as well! 😇
@amithtripst9851
@amithtripst9851 2 ай бұрын
Could you please let us know what is the IDE you are using for practice?
@srilakshmiuvpakala3267
@srilakshmiuvpakala3267 Жыл бұрын
Hi Keerthi, thanks a million for the wonderful videos. I have one question in implementation of singleton design pattern. "Why do we need to make assignment operator in private. Assignment operator gets called when we try to assign existing object to another already existing object. In other words this gets called only when we have two instances already created which we already prevented from happening by making default and copy constructors private.
@AnkitSingh-lb9fj
@AnkitSingh-lb9fj 2 жыл бұрын
great stuff as always, waiting for next video on design pattern
@2008suryan
@2008suryan 2 жыл бұрын
Very good clear explanation. Expecting more videos on other design patterns.
@hari8222
@hari8222 Ай бұрын
nice explanation
@aryankumar87771
@aryankumar87771 2 жыл бұрын
wait wait what was that at the last? making constructor private and operator overloading private... as a non C++ coder that hit me like a train
@anonymoushacker9094
@anonymoushacker9094 2 жыл бұрын
Isn't it better to use static class for logger rather than singleton pattern. Some of the useful example can be parking lot
@amarnathsama
@amarnathsama Жыл бұрын
Can someone explain why we need to have objects of the class at all? why can't getLogger function be static also?
@sasageyo9571
@sasageyo9571 2 жыл бұрын
Are freshers (university grads ) expected to face these questions ? Great video btw !!!
@Archak77
@Archak77 Жыл бұрын
Excellent video ...simple explaination 👍
@KeertiPurswani
@KeertiPurswani Жыл бұрын
Thank you so much! Please do share with your friends?
@shankarBinnar-xl8en
@shankarBinnar-xl8en Жыл бұрын
Thanks Keerti for this video..learn singlton design pattern in detailed . can I get your codes on any website ??
@kingshahzadaamir
@kingshahzadaamir 2 жыл бұрын
Hey Keerti, I tried this on gcc linux terminal. without mutex also it gave single instance all the time. spent 15 minutes to figure out what wrong I wrote. but then tried it on online gdb compiler; there it varied then.
@sheshitkarthikeya1528
@sheshitkarthikeya1528 2 жыл бұрын
Your effort to keep things simple is amazing...Also don't worry no one will steal your logger constructor.😂
@KeertiPurswani
@KeertiPurswani Жыл бұрын
Hehe thank you so much! ❤️❤️
@vivekshivhare8820
@vivekshivhare8820 Жыл бұрын
Can we delete the second time nullptr checking as we are already checking it for mtx locking, or that can also cause some problem? just curious, please do reply..
@jenishadsouza907
@jenishadsouza907 2 жыл бұрын
Really great explanation!!!
@svarajdhanulkar1791
@svarajdhanulkar1791 9 ай бұрын
Yar jo wo problem tha like k if Multithreading is in picture then singleton fails or tabhi muje realise hua uska bhi jugad hota hai par ye interview me pucha tha or sch me tabhi realise hua k hmm such a diff pov
@user-wg4is1ur4k
@user-wg4is1ur4k Жыл бұрын
Thanks Keerti, can you please record the session on "Smart Pointer"
@kushagrabhardwaj4436
@kushagrabhardwaj4436 2 жыл бұрын
Thank you so much for this series :)
@bsratuoh
@bsratuoh Жыл бұрын
It is really a great session and helpful. Thanks for this. If possible pls increase the font size while explaining codes.
@KeertiPurswani
@KeertiPurswani Жыл бұрын
Thanks for the feedback! Hoping it’s better in the present videos! ❤️😇
@powprashant
@powprashant 2 жыл бұрын
Hello Keerti, Thanks for the video, but this is still not complete. Particularly the ownership of the instance, how the instance will be released/destroyed. You can use smart pointer (since C++11) But the best would be using Meyer's Singleton that works with C++98 and C++O3 as well
@niksgupta36
@niksgupta36 2 жыл бұрын
In Double-checked Locking, instead of adding another nullpointer check, could we have just added mtx.lock() and unlock() inside the initial nullpointercheck? Should work right. Let me know.
@geeksentertainmentmedia4827
@geeksentertainmentmedia4827 2 жыл бұрын
You mean putting lock inside if? It would have same problem . Two threads would have entered inside the "if " condition , and then lock would have happened. So one thread would create instance , unlock , then another would have created instance.
@niksgupta36
@niksgupta36 2 жыл бұрын
@@geeksentertainmentmedia4827 Makes sense now. Thanks.
@paraskaushik2639
@paraskaushik2639 Жыл бұрын
Why have you made 3 files ? logger.hpp , logger.cpp and user.cpp . why cant we directly used logger.hpp in user.cpp ? is there some pattern , folder structuring you have followed ?
@vishalsethi4024
@vishalsethi4024 2 жыл бұрын
Great Teacher YOU are
@KeertiPurswani
@KeertiPurswani 2 жыл бұрын
Thank you! Means a lot❤️😇
@rohitsankarpal7866
@rohitsankarpal7866 Жыл бұрын
Can someone help me with VS Code as the thread is not supporting !! Any idea how to resolve that ?
@teluguanimetoon2811
@teluguanimetoon2811 2 ай бұрын
When we delete the instance and created new instance 2nd time in main we are unable to delete the instance which we created 2nd time getting double free error
@shyamchauhan520
@shyamchauhan520 2 жыл бұрын
Nice explanation :) One doubt: when are we going to delete the resource(loggerInstance) which we have created dynamically using new keyword.
@nikhillaad941
@nikhillaad941 2 жыл бұрын
awsome explaination
@siddeo85
@siddeo85 Жыл бұрын
nice video but could you make videos using java?
@mobin1457
@mobin1457 Жыл бұрын
Perfect work
@integrateeverythingpower
@integrateeverythingpower 2 жыл бұрын
Hi didi ,your videos are just awesome keep making videos like this and motivating us
@KeertiPurswani
@KeertiPurswani Жыл бұрын
Thank you! Please keep sharing videos and motivating me! ❤️
@mrCetus
@mrCetus 2 жыл бұрын
One Request: Please give the direct link to the playlist of design patterns you are covering to check other patterns easily.
@KeertiPurswani
@KeertiPurswani Жыл бұрын
There’s a playlist on the channel - Design Patterns kzfaq.info/sun/PLliXPok7ZonlZJuAN0hvUnf5ovFepjxU0 😇😇
@fakecake7608
@fakecake7608 2 жыл бұрын
Great complete Video :)
@whynesspower
@whynesspower 10 ай бұрын
20:05 can you give me the code for that? Will it be something like delete Logger operator=(const Logger &)? Correct me if I am wrong
@athena2986
@athena2986 2 жыл бұрын
Thank you for explaining in detail.can you please create GitHub links for the codes specially the design pattern ones
@meme_engineering4521
@meme_engineering4521 2 жыл бұрын
excellent!!, can someone please tell me if this playlist is enough for sde1 interviews?
@hrudayd4217
@hrudayd4217 2 жыл бұрын
Normally front end developer uses js, learning dsa using js is it useful or not ?
@KeertiPurswani
@KeertiPurswani 2 жыл бұрын
Dsa is useful for sure (language doesn’t matter that much - as long as you can solve questions) But I do know some front end developers who are doing really well and don’t know dsa much.
@potassium_cyanide_boy8515
@potassium_cyanide_boy8515 Жыл бұрын
What if exception is thrown Inside a mutex lock ? It will never ever unlock the mutex and no other thread will be able to enter the critical section or they will keep waiting to mutex to get unlocked that will never happened. So we should use unique_lock or lock_guard i guess 😒😒
@RishabhRD
@RishabhRD 2 жыл бұрын
If you are writing singleton in C++... Meyers singleton is the standard way of doing this. I guess covering meyers singleton was super important not done.... BTW singletons are anti pattern avoid it
@JimitRupani
@JimitRupani 2 жыл бұрын
It was really helpful.
@matheens6689
@matheens6689 Жыл бұрын
You can use semaphore ? Why mutex
@user-en9fs1ev7r
@user-en9fs1ev7r 9 ай бұрын
How about KZfaq adding search option in comments section.
@svarajdhanulkar1791
@svarajdhanulkar1791 9 ай бұрын
Thanks mam
@ss-md4qn
@ss-md4qn 2 жыл бұрын
Superb
@RiyaSingh-nj1fx
@RiyaSingh-nj1fx 2 жыл бұрын
I have 3 things to say.... 1. How is your armpit...seems like due to pole dance you had some issue. 2. Nice explaination 3. How is work at intuit one of my friend joined there and tell me he work day and night and even weekends too.
@PROTECHRAHUL
@PROTECHRAHUL 2 жыл бұрын
Hey diii i didn't get what are you teaching can you please tell? So i can learn it.
@KeertiPurswani
@KeertiPurswani 2 жыл бұрын
Hi Rahul, start watching the design pattern playlist. The first video is introduction of what design patterns are. It should help. Let me know if you have any doubts😇
@PROTECHRAHUL
@PROTECHRAHUL 2 жыл бұрын
@@KeertiPurswani Thanks dii. 🤗
@skandan6266
@skandan6266 2 жыл бұрын
Please make the code view bigger. It becomes difficult to read while watching on a phone
@SaiPrakashdsp
@SaiPrakashdsp 2 жыл бұрын
Can you please write code in python from next videos if possible
@tech_wizard9315
@tech_wizard9315 2 жыл бұрын
Please provide best resume templates for freshers to apply for tech giant's. It's need of many students
@KeertiPurswani
@KeertiPurswani 2 жыл бұрын
Will do!
@varshakancham5944
@varshakancham5944 2 жыл бұрын
Why are locks expensive
Factory Design Pattern - Why and How with Code!!
15:35
Keerti Purswani
Рет қаралды 81 М.
World’s Largest Jello Pool
01:00
Mark Rober
Рет қаралды 124 МЛН
Harley Quinn's plan for revenge!!!#Harley Quinn #joker
00:49
Harley Quinn with the Joker
Рет қаралды 21 МЛН
Joker, what is this doing?!#joker #shorts
00:31
Untitled Joker
Рет қаралды 9 МЛН
5 Design Patterns That Are ACTUALLY Used By Developers
9:27
Alex Hyett
Рет қаралды 244 М.
Singleton Design Pattern with thread safety in C++
14:08
E-GRASP
Рет қаралды 8 М.
Singleton Pattern - Design Patterns (ep 6)
20:09
Christopher Okhravi
Рет қаралды 248 М.
Design patterns in React
14:37
Cosden Solutions
Рет қаралды 156 М.
Singleton Design Pattern in C# - Do it THAT way
13:15
tutorialsEU - C#
Рет қаралды 25 М.
Adapter Design Pattern | Explanation with Code in Easy Way! ✌🏻
19:04
World’s Largest Jello Pool
01:00
Mark Rober
Рет қаралды 124 МЛН