process shared semaphores?
Andrew Gallatin
gallatin at cs.duke.edu
Thu Dec 3 15:30:06 UTC 2009
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
More information about the freebsd-current
mailing list