Boost.Asio C++ Network Programming - Second Edition by Wisnu Anggoro & John Torjo
Author:Wisnu Anggoro & John Torjo [Anggoro, Wisnu]
Language: eng
Format: azw3
Publisher: Packt Publishing
Published: 2015-09-16T04:00:00+00:00
When we run removework.cpp, compared to blocked.cpp, which will block the program infinitely, the following line of text will be displayed to us:
Now, let's dissect the code. As we can see in the preceding code, we used the shared_ptr pointer to instantiate the work object. With this smart pointer provided by Boost, we no longer need to manually delete memory allocation in order to store the pointer since it guarantees that the object pointed to will be deleted when the last pointer is destroyed or reset. Do not forget to include shared_ptr.hpp inside the boost directory as the shared_ptr pointer is defined in the header file.
We also add the reset() function to reset the io_service object when it prepares for a subsequent run() function invocation. The reset() function has to be invoked before any invocation of the run() or poll() functions. It will also tell the shared_ptr pointer to automatically destroy the pointer we created. More information about the share_ptr pointer can be found at www.boost.org/doc/libs/1_58_0/libs/smart_ptr/shared_ptr.htm.
The preceding program explains that we have successfully removed the work object from the io_service object. We can use this functionality if we intend to finish all the pending work even though it hasn't actually been finished yet.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Hello! Python by Anthony Briggs(9913)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9795)
The Mikado Method by Ola Ellnestam Daniel Brolund(9777)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8295)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7778)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7763)
Grails in Action by Glen Smith Peter Ledbrook(7696)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Windows APT Warfare by Sheng-Hao Ma(6818)
Layered Design for Ruby on Rails Applications by Vladimir Dementyev(6547)
Blueprints Visual Scripting for Unreal Engine 5 - Third Edition by Marcos Romero & Brenden Sewell(6414)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6409)
Kotlin in Action by Dmitry Jemerov(5062)
Hands-On Full-Stack Web Development with GraphQL and React by Sebastian Grebe(4316)
Functional Programming in JavaScript by Mantyla Dan(4037)
Solidity Programming Essentials by Ritesh Modi(3992)
WordPress Plugin Development Cookbook by Yannick Lefebvre(3783)
Unity 3D Game Development by Anthony Davis & Travis Baptiste & Russell Craig & Ryan Stunkel(3723)
The Ultimate iOS Interview Playbook by Avi Tsadok(3699)
