Ogre1.7的多线程分析

在OgreConfig.h文件中有关于Ogre使用多线程的配置

1. 多线程支持的级别
/** Support for multithreading, there are 3 options

OGRE_THREAD_SUPPORT = 0
    No support for threading.       
OGRE_THREAD_SUPPORT = 1
    Thread support for background loading, by both loading and constructing resources
    in a background thread. Resource management and SharedPtr handling becomes
    thread-safe, and resources may be completely loaded in the background.
    The places where threading is available are clearly
    marked, you should assume state is NOT thread safe unless otherwise
    stated in relation to this flag.
OGRE_THREAD_SUPPORT = 2
    Thread support for background resource preparation. This means that resource
    data can streamed into memory in the background, but the final resource
    construction (including RenderSystem dependencies) is still done in the primary
    thread. Has a lower synchronisation primitive overhead than full threading
    while still allowing the major blocking aspects of resource management (I/O)
    to be done in the background.
*/
#ifndef OGRE_THREAD_SUPPORT
#define OGRE_THREAD_SUPPORT 0
#endif
#if
OGRE_THREAD_SUPPORT!= 0 && OGRE_THREAD_SUPPORT!= 1 && OGRE_THREAD_SUPPORT!= 2
#define OGRE_THREAD_SUPPORT 0
#endif

2.支持多线程库的thread lib来源
/** Provider for threading functionality, there are 4 options.

OGRE_THREAD_PROVIDER = 0
    No support for threading.
OGRE_THREAD_PROVIDER = 1
    Boost libraries provide threading functionality.
OGRE_THREAD_PROVIDER = 2
    Poco libraries provide threading functionality.
OGRE_THREAD_PROVIDER = 3
    TBB library provides threading functionality.
*/
#ifndefOGRE_THREAD_PROVIDER
#define OGRE_THREAD_PROVIDER 0
#endif

2.1 一个是boost提供的线程库
2.2 一个是Poco libraries

POCO C++ Libraries 提供一套 C++ 的类库用以开发基于网络的可移植的应用程序,功能涉及线程、线程同步、文件系统访问、流操作、共享库和类加载、套接字以及网络协议包括:HTTP、FTP、SMTP 等;其本身还包含一个 HTTP 服务器,提供 XML 的解析和 SQL 数据库的访问接口。
http://www.google.com.hk/search?hl=zh-CN&source=hp&biw=1241&bih=575&q=Poco+libraries&aq=f&aqi=&aql=&oq=
2.3 TBB library
http://threadingbuildingblocks.org/
Intel® Threading Building Blocks (Intel TBB) offers a rich and complete approach to expressing parallelism in a C++ program. It is a library that helps you take advantage of multi-core processor performance without having to be a threading expert. Intel TBB is not just a threads-replacement library. It represents a higher-level, task-based parallelism that abstracts platform details and threading mechanisms for scalability and performance. 

3.Ogre多线程的初始化
在OgreMain中搜索OGRE_THREAD_SUPPORT得出以下文件清单

JLVA[B~A`PCXX4YL5[HZKFX

3.1分析OgreRoot.cpp中有关OGRE_THREAD_SUPPORT的代码:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值