[SciPy-user] shared memory machines
Sturla Molden
sturla at molden.no
Mon Feb 9 06:56:56 EST 2009
On 2/9/2009 12:38 PM, Gael Varoquaux wrote:
> This means that we probably need a shared reference counter :(. Sounds
> tedious to implement.
On System V, you can get the attachment count using shmctl with
IPC_STAT. Then after calling shmdt, checking the count and marking for
removal if it is zero:
int cleanup(int shmid)
{
int ierr;
struct shmid_ds buf;
ierr = shmctl(shmid, IPC_STAT, &buf);
if(ierr < 0) goto error;
if (buf.shm_nattch == 0) {
ierr = shmctl(shmid, IPC_RMID, NULL);
if(ierr < 0) goto error;
}
return 0
error:
return errno;
}
S.M.
More information about the SciPy-User
mailing list