资源简介
TBB,Thread Building Blocks,线程构建模块,是Intel公司开发的并行编程开发的工具。
OSCON 上,Intel 宣布,Threading Building Blocks,Intel 众多软件开发工具中的一个,open source了。协议是 GPLv2。
TBB 获得过 17 届 Jolt Productivity Awards,是一套C++模板库,和直接利用 OSAPI写程序的 raw thread 比,在并行编程方面提供了适当的抽象,当然还包括更多其他内容,比如 task 概念,常用算法的成熟实现,自动负载均衡特性还有不绑定 CPU 数量的灵活的可扩展性等等。STL之父,Alexander Stepanov对此评价不错,他说“Threading Building Blocks… could become a basis for the concurrency dimension of the C++ standard library”。其他 TBB 的早期用户,包括Autodesk,Sun,Red Hat, Turbo Linux 等亦然。现在 O’Reilly 已经出版了一本 Intel Threading Building Blocks: Outfitting C++ for Multi-core Processor Parallelism。
TBB 可以在Windows,Linux和 OSX 上运行,支持 Intel, Microsoft 和GNU工具,这就覆盖了绝大多数需求范围。
代码片段和文件信息
/*
Copyright 2005-2014 Intel Corporation. All Rights Reserved.
This file is part of Threading Building Blocks. Threading Building Blocks is free software;
you can redistribute it and/or modify it under the terms of the GNU General Public License
version 2 as published by the Free Software Foundation. Threading Building Blocks is
distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. You should have received a copy of
the GNU General Public License along with Threading Building Blocks; if not write to the
Free Software Foundation Inc. 51 Franklin St Fifth Floor Boston MA 02110-1301 USA
As a special exception you may use this file as part of a free software library without
restriction. Specifically if other files instantiate templates or use macros or inline
functions from this file or you compile this file and link it with other files to produce
an executable this file does not by itself cause the resulting executable to be covered
by the GNU General Public License. This exception does not however invalidate any other
reasons why the executable file might be covered by the GNU General Public License.
*/
#include “video.h“
#include
#include
unsigned int * g_pImg = 0;
int g_sizex g_sizey;
static video *g_video = 0;
static int g_fps = 0;
#if _WIN32 || _WIN64
static DWORD g_msec = 0;
#ifdef _WINDOWS
HINSTANCE video::win_hInstance = 0;
int video::win_iCmdShow = 0;
void video::win_set_class(WNDCLASSEX &wcex) { }
void video::win_load_accelerators(int idc) { }
#endif //_WINDOWS
#else
#include
#include
struct timeval g_time;
#endif //_WIN32||_WIN64
#define CALC_FPS_ENABLED ((WINAPI_FAMILY != WINAPI_FAMILY_APP) && (!__ANDROID__))
video::video()
// OpenGL* RGBA byte order for little-endian CPU
: red_mask(0xff) red_shift(0) green_mask(0xff00)
green_shift(8) blue_mask(0xff0000) blue_shift(16) depth(24)
{
assert(g_video == 0);
g_video = this; title = “Video“; updating = calc_fps = false;
}
bool video::init_window(int x int y)
{
g_sizex = x; g_sizey = y;
g_pImg = new unsigned int[x*y];
running = true;
return false;
}
bool video::init_console()
{
running = true;
return true;
}
void video::terminate()
{
#if CALC_FPS_ENABLED
if(calc_fps) {
double fps = g_fps;
#if _WIN32 || _WIN64
fps /= (GetTickCount()-g_msec)/1000.0;
#else
struct timezone tz; struct timeval end_time; gettimeofday(&end_time &tz);
fps /= (end_time.tv_sec+1.0*end_time.tv_usec/1000000.0) - (g_time.tv_sec+1.0*g_time.tv_usec/1000000.0);
#endif
printf(“%s: %.1f fps\n“ title fps);
}
#endif
g_video = 0; running = false;
if(g_pImg) { delete[] g_pImg; g_pIm
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2014-12-12 11:58 tbb43_20141204oss\
目录 0 2014-12-12 12:04 tbb43_20141204oss\lib\
目录 0 2014-12-12 12:04 tbb43_20141204oss\lib\ia32\
目录 0 2014-12-12 11:56 tbb43_20141204oss\lib\ia32\vc12_ui\
目录 0 2014-12-12 11:55 tbb43_20141204oss\lib\ia32\vc12_ui\irml\
文件 2956 2014-12-12 11:55 tbb43_20141204oss\lib\ia32\vc12_ui\irml\irml.lib
文件 3058 2014-12-12 11:55 tbb43_20141204oss\lib\ia32\vc12_ui\irml\irml_debug.lib
文件 1924 2014-12-12 11:55 tbb43_20141204oss\lib\ia32\vc12_ui\tbbmalloc_proxy.lib
文件 93358 2014-12-12 11:55 tbb43_20141204oss\lib\ia32\vc12_ui\tbb_debug.lib
文件 183766 2014-12-12 11:55 tbb43_20141204oss\lib\ia32\vc12_ui\tbbproxy.lib
文件 61440 2014-12-12 11:56 tbb43_20141204oss\lib\ia32\vc12_ui\tbbproxy.pdb
文件 61440 2014-12-12 11:56 tbb43_20141204oss\lib\ia32\vc12_ui\tbbproxy_debug.pdb
文件 98032 2014-12-12 11:55 tbb43_20141204oss\lib\ia32\vc12_ui\tbb_preview_debug.lib
文件 91948 2014-12-12 11:55 tbb43_20141204oss\lib\ia32\vc12_ui\tbb.lib
文件 183766 2014-12-12 11:55 tbb43_20141204oss\lib\ia32\vc12_ui\tbbproxy_debug.lib
文件 16776 2014-12-12 11:55 tbb43_20141204oss\lib\ia32\vc12_ui\tbb.def
文件 96510 2014-12-12 11:55 tbb43_20141204oss\lib\ia32\vc12_ui\tbb_preview.lib
文件 9158 2014-12-12 11:55 tbb43_20141204oss\lib\ia32\vc12_ui\tbbmalloc_debug.lib
文件 1871 2014-12-12 11:55 tbb43_20141204oss\lib\ia32\vc12_ui\tbbmalloc.def
文件 8862 2014-12-12 11:55 tbb43_20141204oss\lib\ia32\vc12_ui\tbbmalloc.lib
文件 2002 2014-12-12 11:55 tbb43_20141204oss\lib\ia32\vc12_ui\tbbmalloc_proxy_debug.lib
目录 0 2014-12-12 11:56 tbb43_20141204oss\lib\ia32\vc10\
目录 0 2014-12-12 11:56 tbb43_20141204oss\lib\ia32\vc10\irml\
文件 2956 2014-12-12 11:56 tbb43_20141204oss\lib\ia32\vc10\irml\irml.lib
文件 3058 2014-12-12 11:56 tbb43_20141204oss\lib\ia32\vc10\irml\irml_debug.lib
文件 1924 2014-12-12 11:56 tbb43_20141204oss\lib\ia32\vc10\tbbmalloc_proxy.lib
文件 93358 2014-12-12 11:56 tbb43_20141204oss\lib\ia32\vc10\tbb_debug.lib
文件 230516 2014-12-12 11:55 tbb43_20141204oss\lib\ia32\vc10\tbbproxy.lib
文件 53248 2014-12-12 11:56 tbb43_20141204oss\lib\ia32\vc10\tbbproxy.pdb
文件 53248 2014-12-12 11:56 tbb43_20141204oss\lib\ia32\vc10\tbbproxy_debug.pdb
文件 98032 2014-12-12 11:55 tbb43_20141204oss\lib\ia32\vc10\tbb_preview_debug.lib
............此处省略1515个文件信息
- 上一篇:PC-Lint 9.0L破解修正版
- 下一篇:MODBUS协议主从机程序
评论
共有 条评论