I've looked at the POSIX spec to find the right way to portably
implement low overhead process synchronization.

I think the right way is to add _POSIX_THREAD_PROCESS_SHARED support
so that mutexes can be shared between processes.

There is something vague about the spec.  I don't see that you can
reject "pthread_mutexattr_setpshared()" with EINVAL, and I don't
clearly see that the mutexes in existence after a fork are defined
to be a new set of mutexes with identical existing values.  I have
to assume they are as mutexes can be statically allocated and there
is no way to ensure they are in a shared region without sharing
pages happening to contain mutexes with that attribute of the new
process space with the old one.

Assuming unique mutexes after a fork unless they happen to be in
a shared region, you could create a mutex in shared memory, apply
pthread_mutexattr_setpshared() to it, and then have the usual
pthread_mutex_lock()/pthread_mutex_unlock() interface support the
high performance synchronization.

Peter

--
Peter Dufault ([EMAIL PROTECTED])   Realtime development, Machine control,
HD Associates, Inc.               Fail-Safe systems, Agency approval


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to