- 博客(10)
- 收藏
- 关注
转载 boost::thread (barrier)
#include #include #include #include #include #include // for time() #include // for Sleep, change it for other platform, we can use // boost::thread::sleep, but it's too inconvenient.
2014-06-27 17:22:51
389
转载 boost::thread(Product,consumer)(1)
#include #include #include #include #include #include // for time() #include // for Sleep, change it for other platform, we can use // boost::thread::sleep, but it's too inconvenient.
2014-06-27 16:30:26
278
转载 boost::thread(wait/join/interrupt/detach)
#include #include #include #include #include void wait(int seconds) { boost::this_thread::sleep(boost::posix_time::seconds(seconds)); } void threadfun1() { for (int i = 0; i
2014-06-27 14:49:39
1037
转载 boost::thread(3)
#include #include #include #include #include void wait(int seconds) { boost::this_thread::sleep(boost::posix_time::seconds(seconds)); } boost::mutex mutex; boost::condition_variable
2014-06-27 14:10:07
331
原创 boost:thread2
output 00448138 收到notify! 00448138 收到notify! 00448138 收到notify! 00448138 收到notify! 00448138 收到notify! 00448138 收到notify! 00448138 收到notify! 00448138 收到notify! 00448138 收到notify! 00448138 收到n
2014-06-27 11:20:27
400
原创 thread create method(1)
#include #include #include boost::mutex io_mutex; struct count { count(int id) : id(id) { } void operator()() { for (int i = 0; i { boost:
2014-06-27 10:58:43
271
转载 boost::function的简单用法
#include #include "boost/function.hpp" #include "boost/bind.hpp" using namespace std; class Foo { public: void methodA() { cout } void methodInt(int a) {
2014-06-26 17:04:34
296
原创 内联函数(类中)
成员函数是属于对象的, 静态函数才是属于类的. 如果在类体内定义的函数,则会被编译器默认为内联函数, 如果把函数的定义放在外面,且在函数的声明的时候加上关键字inline,则函数变为内联函数,否则为成员函数.
2014-06-26 15:06:50
324
原创 循环加快——C++
#ifndef LOCALVARIABLES_H_ #define LOCALVARIABLES_H_ #include #include const int N = 10000000; class A { public: int getValue() { return a; } private: int a; }; class TestTime {
2014-06-26 10:13:58
906
原创 shared_ptr
// mem.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include //#include "../../../../../linux/mcsf/uih/include/external/boost/shared_ptr.hpp" #include "boost
2014-06-26 09:52:55
279
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人