interprocess

How to choose a fixed address for shared memory mapping

纵然是瞬间 提交于 2019-12-21 03:52:46
问题 I would like to use shared memory between several processes, and would like to be able to keep using raw pointers (and stl containers). For this purpose, I am using shared memory mapped at a fixed address : segment = new boost::interprocess::managed_shared_memory( boost::interprocess::open_or_create, "MySegmentName", 1048576, // alloc size (void *)0x400000000LL // fixed address ); What is a good strategy for choosing this fixed address? For example, should I just use a pretty high number to

can a python script know that another instance of the same script is running… and then talk to it?

≡放荡痞女 提交于 2019-12-20 09:40:00
问题 I'd like to prevent multiple instances of the same long-running python command-line script from running at the same time, and I'd like the new instance to be able to send data to the original instance before the new instance commits suicide. How can I do this in a cross-platform way? Specifically, I'd like to enable the following behavior: " foo.py " is launched from the command line, and it will stay running for a long time-- days or weeks until the machine is rebooted or the parent process

Simplest way to send messages between Matlab, VB6 and VB.NET programs

别来无恙 提交于 2019-12-20 06:11:44
问题 We are upgrading a suite of data acquisition and analysis routines from VB6 programs to a mixture of VB.NET, VB6, and Matlab programs. We want to keep the system modular (separate EXEs) so we can easily create specialized stand-alone analysis programs without having to constantly upgrade one massive application. We have used MBInterProcess to send messages between EXEs when all the programs were written in VB6 and this worked perfectly for us (e.g., to have the data acquisition EXE send the

boost interprocess file_lock does not work with multiple processes

て烟熏妆下的殇ゞ 提交于 2019-12-20 02:42:26
问题 I seem to be having an issue with boost::interprocess::file_lock I have process 1 that is essentially boost::interprocess::file_lock test_lock("testfile.csv"); test_lock.lock(); sleep(1000); test_lock.unlock(); When I run a second process while the first process is sleeping, I find that I am still able to read testfile.csv. What's worse, I can even overwrite it. Am I misinterpreting how file_lock works? I was under the impression that calling .lock() gives it exclusive lock over the file and

Boost named_mutex and remove() command

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-19 00:57:38
问题 I have a class which can be created by multiple threads. But at one function the code needs to be protected, so I decided to use the boost interprocess mutex. Every class creates or opens the same Mutex in it's constructor: MyClass::MyClass() { boost::interprocess::named_mutex m_Lock( boost::interprocess::open_or_create, "myLock" ); } So now there comes the point where the critical code part is called: int MyClass::MyFunction() { boost::interprocess::scoped_lock<boost::interprocess::named

Trouble with boost::lockfree::queue in shared memory (boost 1.53, gcc 4.7.2 / clang 3.0-6ubuntu3)

柔情痞子 提交于 2019-12-18 05:48:06
问题 I have a problem with placing boost::lockfree::queue<<T, fixed_sized<false>, ..> in shared memory. I need it because I have to be able to insert more than 65535 messages into the queue, and fixed_sized queue is limited with 65535. The following code works properly (but capacity<...> option implies fixed_sized<true> ): typedef boost::interprocess::allocator< MessageT, boost::interprocess::managed_shared_memory::segment_manager> ShmemAllocator; typedef boost::lockfree::queue< MessageT, boost:

c++ boost::interprocess simple application

两盒软妹~` 提交于 2019-12-18 03:44:40
问题 I want to write a simple application with boost that passes string object to other process. It compiles well, but when i try to print out string from second process, following messages are put to console and second process crashes: ../boost_1_44_0/boost/interprocess/sync/posix/interprocess_recursive_mutex.hpp:107: void boost::interprocess::interprocess_recursive_mutex::unlock(): Assertion `res == 0' failed. first process code: shared_memory_object::remove(SHARED_MEMORY_NAME); managed_shared

In node.js, how to declare a shared variable that can be initialized by master process and accessed by worker processes?

旧巷老猫 提交于 2019-12-17 20:34:45
问题 I want the following During startup, the master process loads a large table from file and saves it into a shared variable. The table has 9 columns and 12 million rows, 432MB in size. The worker processes run HTTP server, accepting real-time queries against the large table. Here is my code, which obviously does not achieve my goal. var my_shared_var; var cluster = require('cluster'); var numCPUs = require('os').cpus().length; if (cluster.isMaster) { // Load a large table from file and save it

boost::interprocess_exception - library_error exception when creating shared_memory_object

房东的猫 提交于 2019-12-13 06:17:26
问题 In some rare cases (in fact on a single client's computer) code below throws an exception " library_error ": namespace ipc = boost::interprocess; ipc::shared_memory_object m_shm; ... bool initAsServer(size_t sharedMemSize) { ipc::permissions perm; perm.set_unrestricted(); try { m_shm = ipc::shared_memory_object( ipc::create_only, CNameGenHelper::genUniqueNameUtf8().c_str(), // static std::string genUniqueNameUtf8() ipc::read_write, perm); } catch(const ipc::interprocess_exception& ex) {

Interprocess communication with a Win32 service

↘锁芯ラ 提交于 2019-12-12 20:09:58
问题 The ControlService API allows one send a control code to a Win32 service. However, what if I need to send (and receive) more than a control code? What is the best way to establish communication between a user-mode GUI Win32 application and a Win32 service, to exchange arbitrary pieces of data? (Assume I can compile both the service and the application). The method should work from Windows 2000 to Windows 7, and it should work for both the administrators and the standard users. Thanks! 回答1: It