Tuesday, July 17, 2012

Simplest threading sample in C++11

If you were looking for multitasking and threading library in C++.
C++11 standard brought multitasking for you in the best way.
Here is the simplest threading sample in C++11. I'll post more advanced samples progressively.
I've tested this code sample in VS2012 RC(It's free for download).
#include <thread>
#include <iostream>
void hello()
{
 std::cout << "hello multitasking world!";
}
int main(int argc, char* argv[])
{
 std::thread tr(hello);
 tr.join();
 getchar();
 return 0;
}




No comments :

Post a Comment

Tuesday, July 17, 2012

Simplest threading sample in C++11

If you were looking for multitasking and threading library in C++.
C++11 standard brought multitasking for you in the best way.
Here is the simplest threading sample in C++11. I'll post more advanced samples progressively.
I've tested this code sample in VS2012 RC(It's free for download).
#include <thread>
#include <iostream>
void hello()
{
 std::cout << "hello multitasking world!";
}
int main(int argc, char* argv[])
{
 std::thread tr(hello);
 tr.join();
 getchar();
 return 0;
}




No comments :

Post a Comment