Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 03 Dec 2009 10:29:54 -0500
From:      Andrew Gallatin <gallatin@cs.duke.edu>
To:        Daniel Eischen <deischen@freebsd.org>
Cc:        freebsd-current@freebsd.org
Subject:   Re: process shared semaphores?
Message-ID:  <4B17D972.3000903@cs.duke.edu>
In-Reply-To: <Pine.GSO.4.64.0912021957060.16008@sea.ntplx.net>
References:  <4B16D802.6030904@cs.duke.edu> <Pine.GSO.4.64.0912021617070.16008@sea.ntplx.net> <20091203003705.GA1769@grapeape1.cs.duke.edu> <Pine.GSO.4.64.0912021957060.16008@sea.ntplx.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Daniel Eischen wrote:

> We had this same discussion last time.  You have a
> short memory, don't you?  :-) :-)
> 
> The sem_t in FreeBSD is a pointer to a malloc'd struct
> (see sem_alloc() in libc/gen/sem.c).  A pointer to malloc'd
> memory cannot be shared across processes (unless they are
> all children I suppose).
> 

Argh!  I keep forgetting that is the root of the problem.
I think the previous discussion was more about pthreads.
I guess I'm just a bloody idiot for not realizing that
sems had the same problem.  Now that you remind me,  I even remember
groping around in the library sources, and trying to
use _pthread_mutex_init_calloc_cb() to force the mutex
allocation to come from shared memory.  But now the project
author wants to use semaphores, and I just didn't make the
connection.

Sorry to waste your time..

Drew



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4B17D972.3000903>