Home > Mobile >  QT in the Shared memory process over and over again to read and write more questions, please advice
QT in the Shared memory process over and over again to read and write more questions, please advice

Time:09-17

Process A process to create A Shared memory S repeatedly change variable values in the Shared memory S, process B repeatedly read the Shared memory S variable values there is no problem,,,,,,,

But if add A function in the process A, read in the Shared memory S variable values (which means the process and process B can read the Shared memory variable), as long as the process A this function A read the variables,,,,

Problem - & gt; Changes cannot be process A Shared memory

Changes to the Shared memory code is as follows:
if (! Sharememory - & gt; Create (size))//create the Shared memory, the size of the size
{
QDebug () & lt; return ;
}
Display: QSharedMemory: : create already exists.
But the size of 0?

CodePudding user response:

Multiple processes and modify the Shared memory data should be the result of the uncertainty, otherwise, what's the use of the lock

CodePudding user response:

Read A process applied to open the way to open the Shared memory try, or within A process, use the create directly the result of A pointer, don't create any more
  •  Tags:  
  • Qt
  • Related