www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Error: non-shared method core.sync.condition.Condition.notify is not

reply Paolo Invernizzi <paolo.invernizzi gmail.com> writes:
There's a rational behind the fact that there's not a 'shared' 
version of notify/wait method in Condition?

Thanks,
Paolo
Oct 18 2018
next sibling parent Stanislav Blinov <stanislav.blinov gmail.com> writes:
On Thursday, 18 October 2018 at 10:50:18 UTC, Paolo Invernizzi 
wrote:

 There's a rational behind the fact that there's not a 'shared' 
 version of notify/wait method in Condition?
They were implemented before complete `shared` spec existed, which is any time between it's conception and now.
Oct 18 2018
prev sibling next sibling parent Kagamin <spam here.lot> writes:
On Thursday, 18 October 2018 at 10:50:18 UTC, Paolo Invernizzi 
wrote:
 There's a rational behind the fact that there's not a 'shared' 
 version of notify/wait method in Condition?
core.sync is pretty old, it was written in 2009 before default storage class for global variables became TLS.
Oct 18 2018
prev sibling parent Jonathan M Davis <newsgroup.d jmdavisprog.com> writes:
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
Oct 18 2018