The 𝗰𝗼𝗺𝗺𝗮𝗻𝗱 𝗽𝗮𝘁𝘁𝗲𝗿𝗻 is useful 𝗳𝗼𝗿 𝗺𝘂𝗹𝘁𝗶𝘁𝗵𝗿𝗲𝗮𝗱 𝗰𝗼𝗺𝗺𝘂𝗻𝗶𝗰𝗮𝘁𝗶𝗼𝗻. The pattern has many variants, including templates, unions, polymorphism or std::variant, type erasure etc... Every problem requires a different specific solution, thus a different implementation. This version of the 𝗖𝗼𝗺𝗺𝗮𝗻𝗱 𝗽𝗮𝘁𝘁𝗲𝗿𝗻 with virtual functions, simplest form to implement. This pattern is perfect to pair with a 𝗹𝗼𝗰𝗸-𝗳𝗿𝗲𝗲 𝗿𝗶𝗻𝗴 𝗯𝘂𝗳𝗳𝗲𝗿 or 𝗾𝘂𝗲𝘂𝗲, one way communication between threads, The command pattern AFAIK is also heavily used in Job/Task systems. If you think about it, if we could move the ownership of everything from a thread to another one, would this make multithreading easier to write? Save this post and give it a try! #programming #coding #C++
Stanislav Kirichenko’s Post
More Relevant Posts
-
The 𝗰𝗼𝗺𝗺𝗮𝗻𝗱 𝗽𝗮𝘁𝘁𝗲𝗿𝗻 is useful 𝗳𝗼𝗿 𝗺𝘂𝗹𝘁𝗶𝘁𝗵𝗿𝗲𝗮𝗱 𝗰𝗼𝗺𝗺𝘂𝗻𝗶𝗰𝗮𝘁𝗶𝗼𝗻. The pattern has many variants, including templates, unions, polymorphism or std::variant, type erasure etc... Every problem requires a different specific solution, thus a different implementation. This version of the 𝗖𝗼𝗺𝗺𝗮𝗻𝗱 𝗽𝗮𝘁𝘁𝗲𝗿𝗻 uses a function pointer, simplest form to implement in C. This pattern is perfect to pair with a 𝗹𝗼𝗰𝗸-𝗳𝗿𝗲𝗲 𝗿𝗶𝗻𝗴 𝗯𝘂𝗳𝗳𝗲𝗿 or 𝗾𝘂𝗲𝘂𝗲, one way communication between threads, The command pattern AFAIK is also heavily used in Job/Task systems. If you think about it, if we could move the ownership of everything from a thread to another one, would this make multithreading easier to write? Save this post and give it a try! #programming #code #C++
To view or add a comment, sign in
-
The 𝗰𝗼𝗺𝗺𝗮𝗻𝗱 𝗽𝗮𝘁𝘁𝗲𝗿𝗻 is useful 𝗳𝗼𝗿 𝗺𝘂𝗹𝘁𝗶𝘁𝗵𝗿𝗲𝗮𝗱 𝗰𝗼𝗺𝗺𝘂𝗻𝗶𝗰𝗮𝘁𝗶𝗼𝗻 and more. This version of the 𝗖𝗼𝗺𝗺𝗮𝗻𝗱 𝗽𝗮𝘁𝘁𝗲𝗿𝗻 uses 𝘀𝘁𝗱::𝘃𝗮𝗿𝗶𝗮𝗻𝘁 for a more elegant and modern approach, decoupling the command data from it's execution logic. The pattern has many variants, including templates, unions, polymorphism or std::variant, type erasure etc... Every problem requires a different specific solution, thus a different implementation. This pattern is perfect to pair with a 𝗹𝗼𝗰𝗸-𝗳𝗿𝗲𝗲 𝗿𝗶𝗻𝗴 𝗯𝘂𝗳𝗳𝗲𝗿 or 𝗾𝘂𝗲𝘂𝗲, one way communication between threads, The command pattern AFAIK is also heavily used in Job/Task systems. If you think about it, if we could move the ownership of everything from a thread to another one, would this make multithreading easier to write? Save this post and give it a try! #programming #coding #C++
To view or add a comment, sign in
-
Leetcode potd : Construct the Minimum Bitwise Array II Goal - minimize values of ans[i] such that , ans[i] or ans[i+1] == nums[i] 💭 My thought process I initially started with a brute-force approach, where I tried all possible values of x for each nums[i]. But as the constraints are large, this approach quickly leads to TLE. ⚡ Optimization: So I shifted focus to observing the bitwise behavior of: x | (x + 1) After analyzing it in binary, one key pattern stood out: For any nums[i], once we find the first 0 bit from the right, We can flip the last 1 just before it, And keep the remaining bits unchanged. This directly gives the minimum possible value of ans[i] that satisfies the condition, without trying all possibilities. #problem_solving #bit_manipulation #leetcode #programming #coding
To view or add a comment, sign in
-
-
🚀Looking to the Future: Improved static_assert (C++26) C++26 continues the trend of making the compiler work harder for us, turning "compiler errors" into "developer guidance." #cpp #cpp26 #programming #softwareengineering #metaprogramming #coding
To view or add a comment, sign in
-
-
You can now get your own copy of the Quadrate compiler toolchain on a diskette! The package include a 3.5 inch diskette with pre-combiled binaries as well as the complete source code. In addition it contains a Quadrate demoscene demo, as if the 90s was back, that cannot be found anywhere else. All diskettes are uniquly numbered and comes with printed installation instructions as well as a printed bug report form. https://quad.r8.rs/get/ #programming #compiler #softwareengineering #opensource #stackbased #concatenative #devtools #diskette
To view or add a comment, sign in
-
-
Ruby 4.0.1 Released #Ruby 4.0.1 has been released with #bugfixes including a fix for spurious wakeup from Kernel#sleep when subprocess exits in another #thread. The release follows a bi-monthly schedule for stable versions, with 4.0.2 planned for March. Download links are available in tar.gz, tar.xz, and zip formats with #checksums. #Programming #ComputerScience
To view or add a comment, sign in
-
-
The Fork/Join framework often goes unnoticed, but they can be a game-changer for parallel processing. This framework uses a work-stealing algorithm that enhances CPU utilization by recursively splitting tasks into smaller sub-tasks. It's ideal for complex mathematical calculations, processing large datasets, and handling extensive collections efficiently. While it simplifies parallel execution, developers should be cautious of over-splitting tasks, which can lead to increased complexity and overhead. Have you considered using Fork/Join in your projects? #Java #Multithreading #ForkJoin #Programming #Efficiency
To view or add a comment, sign in
-
-
🚀 Constructors and Destructors: Object Initialization and Cleanup (C++) Constructors are special member functions in C++ that are automatically called when an object is created. They are used to initialize the object's data members and ensure that the object is in a valid state. Destructors are also special member functions that are automatically called when an object is destroyed. They are used to release any resources held by the object, such as dynamically allocated memory, preventing memory leaks. Constructors and destructors are crucial for proper object lifecycle management. Learn more on our website: https://techielearns.com #c++ #programming #coding #tech #learning #professional #career #development
To view or add a comment, sign in
-
-
How to Master Simplicity in Software Architecture https://lnkd.in/gtDBA7HZ #softwaredesign #Minimalism #CleanCode #SoftwareEngineering #UXDesign #Programming #TechPhilosophy #ElegantCode #WebDevelopment #SystemArchitecture #atharvgyan #atharvgyanedu
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development