Re: process shared semaphores?

From: Andrew Gallatin <gallatin_at_cs.duke.edu>
Date: Thu, 03 Dec 2009 10:29:54 -0500
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
Received on Thu Dec 03 2009 - 14:30:06 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:58 UTC