TBB example source code ( parallel_invoke function )

You need TBB lib to run this source code.

Download TBB file, and unzip your propely new folder in your computer.
And copy dll files into windows\system folder.

TBB download url -> https://www.threadingbuildingblocks.org/download

 
 
Set path of TBB incoude, lib location on the Visual studio.
 



This is example source code.
 

/////
#include < stdio.h>
#include < tchar.h>
#include < time.h>
#include < tbb/tbb.h>

#ifdef _DEBUG
#pragma comment(lib, "tbb_debug.lib")
#else
#pragma comment(lib, "tbb.lib");
#endif // _DEBUG

using namespace tbb;

void main()
{
 task_scheduler_init init;

 parallel_invoke(
  []()->void
 {
  ::Sleep(1000);
  ::printf("finish:%d\n", 1000);
 },
  []()->void
 {
  ::Sleep(1000);
  ::printf("finish:%d\n", 10000);
 });

 printf("All work is done \n");

 getchar();
 
}
/////

Comments

Popular posts from this blog

(OpenCV Study) Background subtractor MOG, MOG2, GMG example source code (BackgroundSubtractorMOG, BackgroundSubtractorMOG2, BackgroundSubtractorGMG)

OpenCV Stitching example (Stitcher class, Panorama)

Example source code of extract HOG feature from images, save descriptor values to xml file, using opencv (using HOGDescriptor )

Real-time N camera stitching Class.

Optical Flow sample source code using OpenCV

OpenCV Drawing Example, (line, circle, rectangle, ellipse, polyline, fillConvexPoly, putText, drawContours)

Video Stabilization example source code, (using cvFindHomography, cvWarpPerspective functions in openCV)

SICK LMS511 sensor data acquisition interface (source code, C++/MFC)

8 point algorithm (Matlab source code) / The method to get the Fundamental Matrix and the Essential matrix

Image warping (using opencv findHomography, warpPerspective)