Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pthread_condattr_setpshared



> Continuing in the vein of the pthread_cond_signal thread...
>
> POSIX also discusses a process-shared attribute:
>
>   The process-shared attribute is set to PTHREAD_PROCESS_SHARED to
>   permit a condition variable to be operated upon by any thread
>   that has access to the memory where the condition variable is
>   allocated, even if the condition variable is allocated in memory
>   that is shared by multiple processes.
>
> with more details in:
>
>   https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_09_09
>
> This isn't something we support, but it cropped up in the context of
> gfortran:
>
>   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124512
>
> It wasn't clear that it was necessary, just that FreeBSD has it.
> I'm not sure what "it" is? Discuss :-)
>
>
> Cheers,
>
> Patrick
>

   I use pshared mutex/cond all the time for $WORK. It allows the
mutex/cond to be placed in shared memory/mmap and synchronize among
processes instead of just threads of the same process. There is also a
"robust" flavor of mutex which detects when the process holding the
mutex dies. In that case, the next process making a lock attempt on the
abandoned mutex gets an EOWNERDEAD, holds the mutex, and is responsible
for any cleanup. There is no robust cond.

   It would be useful to have them if I ever wanted to port GT.M to
NetBSD, but I don't know that that would create a lot of value for
anyone.

                              Gary Duzan





Home | Main Index | Thread Index | Old Index