On Tue, 3 Oct 2017 08:36:55 -0600 Eric Snow <ericsnowcurrently at gmail.com> wrote: > On Tue, Oct 3, 2017 at 5:00 AM, Antoine Pitrou <solipsis at pitrou.net> wrote: > > On Mon, 2 Oct 2017 22:15:01 -0400 > > Eric Snow <ericsnowcurrently at gmail.com> wrote: > >> > >> I'm still not convinced that sharing synchronization primitives is > >> important enough to be worth including it in the PEP. It can be added > >> later, or via an extension module in the meantime. To that end, I'll > >> add a mechanism to the PEP for third-party types to indicate that they > >> can be passed through channels. Something like > >> "obj.__channel_support__ = True". > > > > How would that work? If it's simply a matter of flipping a bit, why > > don't we do it for all objects? > > The type would also have to be safe to share between interpreters. :) But what does it mean to be safe to share, while the exact degree and nature of the isolation between interpreters (and also their concurrent execution) is unspecified? I think we need a sharing protocol, not just a flag. We also need to think carefully about that protocol, so that it does not imply unnecessary memory copies. Therefore I think the protocol should be something like the buffer protocol, that allows to acquire and release a set of shared memory areas, but without imposing any semantics onto those memory areas (each type implementing its own semantics). And there needs to be a dedicated reference counting for object shares, so that the original object can be notified when all its shares have vanished. Regards Antoine.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4