Issue with Resource Manager Threads


I am facing a problem with the shared memory access inside the resource manager thread.

I have shared library, which basically does the memory mapping, for example sh_lib_init().

I have written a resource manager, and it have multiple threads. These threads access this shared memory, mapped by this sh_lib_init() library. For read access to shared memory I have no problem, but any of the spawned thread inside resource manager dows not able to access this shared memory in write mode. But the main Resource manager process is able to write to this shared memory.

On top of this, if I created these threads before attaching to the resource manager, I am also able to write to this shared memory from any of the spawned threads.

I have no clue why this is happening!!!

in brief, here is the scenarios,


attach to resource manager…

spawns threads → These thread can not write to the shared memory,
… Only read is allowed.


spawns threads → These thread have full access to shared memory,
… write + read both are allowed.

attach to resource manager…

Any idea, what could be wrong!!

Here is the functions I am calling to attaching the program to resource manager,

  1. dispatch_create()
  2. iofunc_func_init(…)
  3. iofunc_attr_init(…)
  4. resmgr_attach(…)

Is there any special flag / value I need to pass to allow the spawned threads to access the shared memory in writing mode also!!!

Many thanks in advance,

Best Regards,

Post code of sh_lib_init, this doesn’t make any sense to me.

What does “not able to access this shared memory in write mode” mean? Do you get a protection exception, or does the write just not occur, as seen from other threads?