Does D have equivalent of Java util.concurrent?

Russel Winder russel at winder.org.uk
Wed May 22 10:28:27 UTC 2019


On Sun, 2019-04-28 at 09:21 +0000, Dibyendu Majumdar via Digitalmars-d wrote:
> 
[…]
> I wasn't talking about the cost of passing data, more about the 
> cost of operations with this.
> 
> Say we have something like this.
> 
> 
> SomeFunc(data)
>      various ops with data
>      return data
> 
> There should not be any extra overhead in the 'ops' part above. 
> In C++ if data was marked volatile, then there would be an 
> impact, but not otherwise, apart from the standard optimisation 
> rules to do with data escaping, or aliasing something.

In a single threaded context this is entirely right. In a multi-threaded
context then it is very likely that the "various ops with data" would be
wrapped with a std::mutex or similar. The overhead is before and after the
"various ops with data", the ops themselves should not have any overhead.

-- 
Russel.
===========================================
Dr Russel Winder      t: +44 20 7585 2200
41 Buckmaster Road    m: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20190522/30a0afba/attachment.sig>


More information about the Digitalmars-d mailing list