

GTest (Google Unit Test) with Visual Studio 2012 Sponsor Open Source development activities and free contents for everyone.Īpplication (UI) - using Windows Forms (Visual Studio 2013/2012)īoost - shared_ptr, weak_ptr, mpl, lambda, etc.īoost.Asio (Socket Programming - Asynchronous TCP/IP).Ĭ++11(C++0x): rvalue references, move constructor, and lambda, etc.Įclipse CDT / JNI (Java Native Interface) / MinGWĮmbedded Systems Programming I - IntroductionĮmbedded Systems Programming II - gcc ARM Toolchain and Simple Code on Ubuntu and FedoraĮmbedded Systems Programming III - Eclipse CDT Plugin for gcc ARM Toolchainįunctors (Function Objects) I - Introductionįunctors (Function Objects) II - Converting function to functor Move semantics and Rvalue Reference (from C++11 Thread tutorial) Rvalue and Lvalue (from C++11 Thread tutorial) Static assertions and Constructor delegation

The nullptr and strongly typed enumerations Type Inference (auto) and Range-based for loop By just putting the i as in the following line, we can pass the index into the thread function:

Since we're using lambda, we can utilize its capture capability. Non-deterministic nature of concurrent programmingĪs we can see from the output, we cannot tell which thread is printing which. Then, joins one by one, and this works like barrier. The lambda function takes its argument as a reference to a thread, t. The '' tells the compiler we're using lambda. We loop through every thread via for_each(), and its 3rd argument assigns a task. The vector container workers stores 5 threads created, and after they finished the task they are joined with the main thread:

Std::for_each(workers.begin(), workers.end(), (std::thread &t) Then, joins one by one, and this works like barrier The lambda function takes its argument as a reference to a thread, t It tells the compiler we're using lambda () This has the following advantages over C++98 alternatives: it is where the code would logically be (as opposed to defining a class/function somewhere outside this scope), and it does not pollute any namespace (although this could be easily be bypassed even in C++98).In this section, we'll see the usefulness of lambda function for multi-threading. Essentially they are an easy way to write functions (such as callbacks) in the logical place they should be in the code. Lambdas are a fancy name for anonymous functions. Here’s a quick recap if you have yet to use one of the most powerful features of C++11 – lambdas: Then we’ll look into std::function and how it works. In this post we’ll explore how lambdas behave in different aspects.
