![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
多线程
文章平均质量分 86
Alan Lan
高精地图、定位、VSLAM、VIO、LIO、多传感器标定、自动驾驶、无人机、点云处理
展开
-
ros callback 回调机制 & 订阅队列长度
实验程序:talker.cc#include <std_msgs/Int32.h>#include <ros/ros.h>int main(int argc, char **argv) { ros::init(argc, argv, "talker"); ros::NodeHandle nh; std_msgs::Int32 data; data.data = 0; ros::Publisher pub = nh.adve.原创 2021-03-22 11:56:18 · 5751 阅读 · 4 评论 -
多线程并行
#include <iostream>#include <omp.h>#include <thread>#include <chrono>void print(size_t i) { std::this_thread::sleep_for(std::chrono::milliseconds(3000+i)); std::cout << i << ", thread id: " << std::ha.原创 2020-05-21 16:43:18 · 2499 阅读 · 0 评论 -
C++11多线程之互斥量(mutex)与条件变量(condition_variable)
示例程序条件变量和std::mutex合用,这是为了线程间通信。#include <iostream>#include <string>#include <thread>#include <mutex>#include <condition_variable> std::mutex m;std::condition_variable cv;std::string data;bool ready = false;bool原创 2021-03-21 16:34:42 · 5433 阅读 · 0 评论