![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
多线程
文章平均质量分 69
fly1ng_duck
这个作者很懒,什么都没留下…
展开
-
代码流程笔记
首先是slam初始化。管理程序初始化, 设定catkinroute激光信息初始化,SWin_XYRange初始化srv.almatch和packdata小车的信息 tool_tfm.renew_data(tfpub_odomdta, param_lsrlocation); tf 更新里程计启动里程计接收器 sin_chart_init(); 图标?这是什么看构造函数,boost function ...原创 2018-04-07 19:42:57 · 258 阅读 · 0 评论 -
c++ concurrency in action 3.5cpp
#include <exception>#include <stack>#include <mutex>#include <memory>#include <iostream>//Cargill 困境就是说在stack 中大内存的复制,如果pop出来没位置,造成数据的缺失struct empty_stack1 : std:...原创 2018-07-18 16:05:16 · 123 阅读 · 0 评论 -
c++ concurrency in action 3.3cpp
#include <deque>template<typename T, typename Container = std::deque<T> >class stack{public: explicit stack(const Container&); explicit stack(Container&& = Contai...原创 2018-07-18 11:00:28 · 106 阅读 · 0 评论 -
c++ concurrency in action 3.2cpp
#include <mutex>class some_data{ int a; std::string b;public: void do_something() {}};class data_wrapper{private: some_data data;//上一节对应的类设计 std::mutex m;public: template<ty...原创 2018-07-17 17:05:10 · 118 阅读 · 0 评论 -
c++ concurrency in action 3.1cpp
#include <list>#include <mutex>#include <algorithm>std::list<int> some_list;//全局变量std::mutex some_mutex;//一般是通过类设计,锁和data是private,而function成为成员函数,但是如果成员函数返回指向data的指针,就会造...原创 2018-07-17 16:15:36 · 124 阅读 · 0 评论 -
c++ concurrency in action 学习总结第二章
有三种callable 的thread launch然后wait for thread to complete一定要detach join 而且还有个例外是exception2.运行同一程序的不同内容,可以让新内容detached开线程除了pass the function name to the thread constructor 例如 std::thread t(function name)...原创 2018-07-16 20:23:49 · 210 阅读 · 0 评论 -
boost库管理多线程的函数
boost::recursive_mutex http://www.169it.com/article/6167267338722791624.htmlhttps://www.boost.org/doc/libs/1_31_0/libs/thread/doc/recursive_mutex.htmlhttps://www.jianshu.com/p/0b2e360243f4https://ke.q...原创 2018-04-04 19:12:01 · 139 阅读 · 0 评论 -
多线程3
昨天忘记贴这个帖子的链接了点击打开链接在下面的例子中,我们创建一个键,并将它和某个数据相关联。我们要定义一个函数createWindow,这个函数定义一个图形窗口(数据类型为Fl_Window *,这是图形界面开发工具FLTK中的数据类型)。由于各个线程都会调用这个函数,所以我们使用线程数据。/* 声明一个键*/pthread_key_t myWinKey;/* 函数 createWindow...原创 2018-04-03 10:50:11 · 126 阅读 · 0 评论 -
多线程 2
4. 线程的数据处理 和进程相比,线程的最大优点之一是数据的共享性,各个进程共享父进程处沿袭的数据段,可以方便的获得、修改数据。但这也给多线程编程带来了许多问题。我们必须当心有多个不同的进程访问相同的变量。许多函数是不可重入的,即同时不能运行一个函数的多个拷贝(除非使用不同的数据段)。在函数中声明的静态变量常常带来问题,函数的返回值也会有问题。因为如果返回的是函数内部静态声明的空间的地址,则在一...原创 2018-04-02 19:49:27 · 110 阅读 · 0 评论 -
多线程
先补上一个Qt的快捷键 刚才在Ubuntu下没保存 fuck 点击打开链接然后再谈谈多线程的理解 逼乎高赞说的还行点击打开链接首先是概念的区分,线程与进程,未经深思熟虑的想法是,看了这回答,我想起了贴吧老哥那句轮X也轮不到你。。。。2333cpu在多核的情况先多进程的性能是要好于多线程的。。这个很好理解 。继续运用贴吧老哥的例子就是有多个到达交配阶段的雌性动物的时候,一夫一妻制是相对较好的,如果...原创 2018-04-02 19:16:04 · 109 阅读 · 0 评论 -
Boost多线程的学习
#include <boost/thread.hpp> #include <iostream> void wait(int seconds) { boost::this_thread::sleep(boost::posix_time::seconds(seconds)); } void thread() { for (int i = 0; i &...原创 2018-04-08 11:10:19 · 186 阅读 · 0 评论 -
死锁deadlocking
a pair of mutexes A and B an object needs to unlock both mutexes to do some operationsif(object 1 owns Aobject 2 owns B ) both of objects can not perform some operations原创 2018-07-18 16:46:02 · 132 阅读 · 0 评论