This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: cygserver cleanup thread
Le mer 11/08/2004 Ã 10:50, Corinna Vinschen a Ãcrit :
> On Aug 11 10:13, bertrand marquis wrote:
> > Hello,
> >
> > i'm making a program using shared memory and as a consequence i need to
> > use the cygserver. But when i close my program the ipcs give me this
> > output:
> >
> > $ ipcs -ma
> > Shared Memory:
> > T ID KEY MODE OWNER GROUP CREATOR
> > CGROUP NATTCH SEGSZ CPID LPID ATIME DTIME CTIME
> > m 262144 0 --rw------- bma Kein bma
> > [...]
> >
> > In fact all the shared memory i used is still there and is used by
> > nobody (NNATCH 0). I thought that the cleanup thread of the cygserver
> > was supposed to clean those but i have to remove them myself. Is this a
> > normal behavior ? Is there something to configure in cygserver to clean
> > those ?
>
> This is normal behaviour. SYSV IPC is designed to keep the IPC elements
> intact even if no process is accessing them. If you want to get rid of
> them, then you have to do this by using the appropriate IPC_RMID control
> call:
>
> msgctl (msgid, IPC_RMID, NULL);
> semctl (semid, 0, IPC_RMID);
> shmctl (shmid, IPC_RMID, NULL);
>
Thank you, i will try to find a way to call shmctl from the last thread
running.
> If you're creating an application which needs shared memory only on
> runtime, which should disappear when the last application using it
> exits, consider to use simple mmap calls. It's way easier than having
> to run cygserver.
>
>
> Corinna
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/