开发者

when using shared memory in unix

When you code a data supplier app in C 开发者_如何转开发for Unix that uses shared memory when do you detach the shared memory only when the server exits or when you are finished updating the shared memory ?


AFAIK, keeping it attached will not bother.

However since the attachment tracks the number of processes attached, if that count is >0, then you won't be allowed to destroy your shm until that count get back to 0 (in other words when all process are detached). If you have a main process attached, I'm not sure you will be able to destroy it from an external "administrative" process for you shm.

In my personnal experience, I don't detach the SHM after write operations, only at process exit.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜