C# 5.0: await and Reentrancy

January 28, 2013

The relatively new async/await keywords in C# 5.0 are truly great. I’ve been using them for a while now, and I always contrast these to the way things can be done in C++11; and even with the help of PPL tasks – it stands out as clearly victorious, with its ease of use and lack of verbosity.In fact, it’s so easy to use that I find myself creating new methods that are mostly “Async”, even if the benefit may not be that great – just because it’s easy to do.For example, suppose there is a method that does some...

Making HTTP calls in WinRT with C++

January 14, 2013

When working with Windows Store applications (“metro”), it’s sometimes necessary to make HTTP calls. one classic example is to register for push notifications. After obtaining a unique channel URI, the app needs to send that URI to its application server, as that particular URI is the one to use by the application server to execute a push notification against the Windows Notification Service (WNS).Getting the channel URI is fairly simple, with a call to the static PushNotificationChannelManager::CreatePushNotificationChannelForApplicationAsync method. Now comes the tricky part: how to send the resulting URI to the application server?In .NET, things are relatively easy. Just use...