This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cygserver cleanup thread


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);

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

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Co-Project Leader          mailto:cygwin@cygwin.com
Red Hat, Inc.

--
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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]