Error: non-shared method core.sync.condition.Condition.notify is not callable using a shared object

Jonathan M Davis newsgroup.d at jmdavisprog.com
Thu Oct 18 19:27:28 UTC 2018


On Thursday, October 18, 2018 4:50:18 AM MDT Paolo Invernizzi via 
Digitalmars-d-learn wrote:
> There's a rational behind the fact that there's not a 'shared'
> version of notify/wait method in Condition?
>
> Thanks,
> Paolo

The original author of the stuff in core.sync didn't want to update it for
shared when shared was first introduced, because he didn't think that it was
well enough defined yet (e.g. there was discussion over whether it should
have write barriers or not). Some work has been done to improve shared
support in there since then but not enough. shared _does_ still need need
some rough edges sorted out (it's supposed to guarantee that you can't do
any operations on it that isn't thread-safe, but while many operations are
illegal, some which should be aren't, and some of the finer details likely
need to be cleaner up). The basics of shared have been in place and working
fine for nearly a decade, but because we've been waiting for the finer
details to be finished, and it's never been a high enough priority for that
to happen, stuff like core.sync has suffered. It doesn't help that the vast
majority of D programs don't need to do much with shared, and those that D
use higher level mechanisms such as std.concurrency or use something like
the framework that vibe.d provides.

However, as annoying as it is, with some extra casting, the pieces of
core.sync that haven't been updated properly _can_ be used with shared.
shared in general requires unsafe casting and always will. There really
isn't any way around that, but the parts of core.sync that don't use shared
properly will require that much more of it, unfortunately.

There's no question though that the situation with core.sync needs to be
fixed. Some of it has been worked on, but nowhere near enough.

- Jonathan M Davis





More information about the Digitalmars-d-learn mailing list