开发者

How can I create an apr_table_t type's table in shared memory segment?

How can I create an 开发者_如何学Goapr_table_t type's table in shared memory segment?


There is no way to create that except of writing your own implementation. Note that you must predefine the maximum amount of memory that your hash table will take since APR doesn't support a shared memory segments resizing. However you can use APR DBM library to create a thread-safe file database based on a hash table, it's pretty fast and easy to use.


This may not be possible unless shared memory is mapped to the same virtual address.

Documentation for the apr_shm_baseaddr_get function says:

Retrieve the base address of the shared memory segment. NOTE: This address is only usable within the callers address space, since this API does not guarantee that other attaching processes will maintain the same address mapping.

APR apr_shm_baseaddr_get documentation

Internally the apr_table_t struct is using apr_array_header_t which contains pointers to apr_pool_t and char (array elements).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜