Shared memory attached process count.

  • Thread starter Thread starter Sagar Shedge
  • Start date Start date
S

Sagar Shedge

Guest
Hello,

I want to use shared memory in my application. I have created shared memory and successfully using between 2 processes.

I want to know how many (only count) processes attached to shared memory. So if only 1 process is attached to shared memory then I want to destroy shared memory.

API used to create and destroy shred Memory ->

char key_name [50] = {0};
snprintf(key_name, 50, "Global\\%d",key);

mMemId = CreateFileMapping(INVALID_HANDLE_VALUE,NULL,PAGE_READWRITE,0,size,key_name);

mMem = MapViewOfFile(mMemId, FILE_MAP_ALL_ACCESS, 0, 0, size);

UnmapViewOfFile(mMem);
CloseHandle(mMemId);

Continue reading...
 
Back
Top