07.12.2013 22:35 пользователь "Ted Unangst" <t...@tedunangst.com> написал:
>
> On Sat, Dec 07, 2013 at 21:32, Vadim Zhukov wrote:
> > 2013/12/7 Ted Unangst <t...@tedunangst.com>:
> >> On Sat, Dec 07, 2013 at 14:11, Vadim Zhukov wrote:
> >>> This patch fixes problems in KDE4, that relies on sharing
(process-shared)
> >>> semaphores via mmap(). This feature is used in the wild, so if we
claim
> >>> that we support process-shared semaphores, we have to implement it,
too.
> >>>
> >>> This changes the sem_t definition: it becomes a synonim to struct
__sem
> >>> instead of being a pointer to it. This way we allow apps to have
sem_t in
> >>> shared memory via sem_init() and thus share it between processes (by,
> >>> e.g., mmap()'ing the same file). Of course, this forces a major
library
> >>> version bump.
> >>
> >> This requires more thought. If the introduction of pshared support is
> >> breaking things, maybe just that part can be reverted for now.
> >
> > Well, it's the half-done introduction of pshared support is breaking
> > things. I do not see any fallout now that sharing unnamed semaphores
> > works. But what we'll gain with revert? Except that it's still better
> > than current situation.
>
> One of the hallmarks of the original libpthread was that all data
> structures were opaque, and hidden via pointers. That in turn made it
> possible to write a binary compatible librthread. I never would have
> started librthread if it hadn't been for that compatibility. So I
> don't like turning my back on it. Exposing the size of sem_t is a
> *major* step.

Then we have to state that we won't support process-shared semaphores, as
well as mutexes and other locks, ever. Because all of them should have
ability to live in shared memory.

The only other way to achieve process-shared locks I see, is to use sem_t
and others as indexes in some kernel structures (like file descriptors),
moving most of librthread into the kernel. That sounds too crazy even for
me. :)

I like opaque types of librthread, too. And I hate what I did with one of
them already. Too bad for us that the world does not care. :(

Reply via email to