简体   繁体   English

使用message_queue和shared_memory时提升库错误

[英]boost library error while using message_queue and shared_memory

I'm using shared_memory and message_queue from the boost library. 我正在使用boost库中的shared_memory和message_queue。

A image processing application provides parameter and 3D points in a shared_memory and a gui-application grabs the data out of the memory. 图像处理应用程序在shared_memory中提供参数和3D点,而gui应用程序从内存中获取数据。 The synchronisation works with message_queue's. 同步适用于message_queue。 It works well in a short run but after a longer perdiod fatal errors occurs and also a restart does not help. 它在短期内运行良好,但是在出现较长时间的致命错误之后,重新启动也无济于事。 After that it's not possible to create a new shared_memory section or a message_queue. 之后,将无法创建新的shared_memory部分或message_queue。 Creating a new message_queue fails with 'BOOST_ASSERT (ptr != 0)'. 创建新的message_queue失败,并显示“ BOOST_ASSERT(ptr!= 0)”。 A part of the init part looks like the code below (is also not working anymore): init部分的一部分类似于下面的代码(也不再起作用):

//initializing default values - VoxelGrid_X
message_queue::remove("param_VX");
message_queue mq_VX(create_only, "param_VX", 1, sizeof(double));
mq_VX.try_send(&parameter_VX, sizeof(parameter_VX), 0);
ui->lineEdit_VX->setPlaceholderText(QString::number(convert_m_mm(parameter_VX)));

A part of reading out the parameter in the image-processing app looks like the code below: 在图像处理应用程序中读取参数的一部分类似于以下代码:

//VoxelGrid: X
                            try {
                                unsigned int priority_VX = NULL;
                                message_queue::size_type recv_size_VX = NULL;
                                message_queue mq_VX(open_only, "param_VX");
                                mq_VX.try_receive(&leafSizeX, sizeof(leafSizeX), recv_size_VX, priority_VX);
                            }
                            catch (interprocess_exception &ex) {

                            }

What could be the problem? 可能是什么问题呢? Does anybody have similar experiences? 有人有类似的经历吗? I would be happy to get hints about possible solutions. 我很高兴获得有关可能解决方案的提示。

Best regards, T 最好的问候,T

I got it ... it's a weird problem, but it in that case is necessary to define the place, where the shared_memory has to be stored. 我知道了...这是一个奇怪的问题,但是在那种情况下,有必要定义必须存储shared_memory的位置。 In my case: 就我而言:

#define BOOST_INTERPROCESS_SHARED_DIR_PATH "C:/Shared_Memory " #define BOOST_INTERPROCESS_SHARED_DIR_PATH "C:/Shared_Memory

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM