Effective Modern C++ [PDF]

PDF Preview:

Effective Modern C - www.indianpdf.com_ - Free book novel - download online

PDF Title : Effective Modern C++
PDF Content : 42 Chapters/items
Total Page : 334 Pages
Author: Scott Meyers
PDF Size : 1.1 MB
Language : English
Rights : oreilly.com
PDF Link : Available
,

Summary
Here on this page, we have provided the latest download link for Effective Modern C++ PDF. Please feel free to download it on your computer/mobile. For further reference, you can go to oreilly.com

Effective Modern C++ – Book

This approach avoids the problems we’ve discussed. It works regardless of whether the reacting task waits before the detecting task notifies, it works in the presence of spurious wakeups, and it doesn’t require polling. Yet an odor remains because the detecting task communicates with the reacting task in a very curious fashion.

Notify‐ ing the condition variable tells the reacting task that the event it’s been waiting for has probably occurred, but the reacting task must check the flag to be sure. Setting the flag tells the reacting task that the event has definitely occurred, but the detecting task still has to notify the condition variable so that the reacting task will awaken and check the flag. The approach works, but it doesn’t seem terribly clean.

An alternative is to avoid condition variables, mutexes, and flags by having the react‐ ing task wait on a future that’s set by the detecting task. This may seem like an odd idea. After all, Item 38 explains that a future represents the receiving end of a communications channel from a callee to a (typically asynchronous) caller, and here there’s no callee-caller relationship between the detecting and reacting tasks.

However, Item 38 also notes that a communications channel whose transmitting end is a std::promise and whose receiving end is a future can be used for more than just callee-caller communication. Such a communications channel can be used in any situation where you need to transmit information from one place in your program to another. In this case, we’ll use it to transmit information from the detecting task to the reacting task, and the information we’ll convey will be that the event of interest has taken place.

Effective Modern C++ PDF


Why you should buy from amazon? It is always better to buy books in order to support the authors and publishers. As the hard-working writer diligence should be paid off.

Know more about our initiative

Help us to serve you better. Rate this PDF
[ Total: 1 | Average: 5 ]

If you find this PDF violating your rights, and you want to unpublish it, Please Contact-Us / DMCA.