Commit 00d3bb3e authored by 's avatar
Browse files

remove and detach shared memory segments at mapid exit

git-svn-id: file:///home/svn/mapi/trunk@579 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 24ae7d9a
......@@ -135,7 +135,7 @@ mapid_init(mapidlib_instance_t *i)
if((i->shm_spinlock_id=shmget(i->shm_spinlock_key,sizeof(pthread_spinlock_t),FUNCTION_SHM_PERMS | IPC_CREAT)) < 0)
return MDLIB_SHM_ERR;
if((i->shm_spinlock=shmat(i->shm_spinlock_id,0,0))==NULL)
return MDLIB_SHM_ERR;
......@@ -309,7 +309,15 @@ void mapid_destroy(mapidlib_instance_t *i)
#endif
free(i->flowlist);
// pthread_spin_unlock(i->shm_spinlock);
if (shmdt((const void*)i->shm_spinlock)<0) {
WARNING_CMD(printf("Warning: Could not detach shared mem (%s) [%s:%d]\n",strerror(errno),__FILE__,__LINE__));
}
if (shmctl(i->shm_spinlock_id,IPC_RMID,NULL)<0) {
WARNING_CMD(printf("Warning: Could not free shared mem (%s) [%s:%d]\n",strerror(errno),__FILE__,__LINE__));
}
}
else if (libs_loaded>0) {
mapilh_free_libraries();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment