Ejemplo n.º 1
0
void shm_mem_destroy(void)
{
#ifndef SHM_MMAP
	struct shmid_ds shm_info;
#endif
	
	DBG("shm_mem_destroy\n");
#ifndef SHM_SAFE_MALLOC
	if (mem_lock){
		DBG("destroying the shared memory lock\n");
		lock_destroy(mem_lock); /* we don't need to dealloc it*/
	}
#endif  /*SHM SAFE_MALLOC */
	if (shm_block){
		shm_malloc_destroy(shm_block);
		shm_block=0;
	}
	if (shm_mempool && (shm_mempool!=(void*)-1)) {
#ifdef SHM_MMAP
		munmap(shm_mempool, /* SHM_MEM_SIZE */ shm_mem_size );
#else
		shmdt(shm_mempool);
#endif
		shm_mempool=(void*)-1;
	}
#ifndef SHM_MMAP
	if (shm_shmid!=-1) {
		shmctl(shm_shmid, IPC_RMID, &shm_info);
		shm_shmid=-1;
	}
#endif
}
Ejemplo n.º 2
0
 inline ~FastSharedMemoryPool()
 {
     shm_malloc_destroy(m_mem_block);
     if (m_managed_self)
     {
         delete m_raw_pool;
     }
 }