Thread overview
[Issue 13930] std.concurrency can't send immutable AA to another thread
Jan 05, 2015
Martin Nowak
Jan 05, 2015
Martin Nowak
Dec 25, 2016
JR
Oct 08, 2020
Tomoya Tanjo
Oct 09, 2020
Dlang Bot
Oct 10, 2020
Dlang Bot
Oct 10, 2020
Dlang Bot
January 05, 2015
https://issues.dlang.org/show_bug.cgi?id=13930

Martin Nowak <code@dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|std.concurrency can't       |std.concurrency can't send
                   |immutable AA send to        |immutable AA to another
                   |another thread              |thread

--
January 05, 2015
https://issues.dlang.org/show_bug.cgi?id=13930

--- Comment #1 from Martin Nowak <code@dawg.eu> ---
Receiving immutable AAs doesn't work either.

cat > bug.d << CODE
import std.concurrency;

void main()
{
    auto aa = receiveOnly!(immutable string[string]);
}
CODE

dmd -c bug

DPL/dmd/src/../../phobos/std/concurrency.d(760): Error: cannot modify immutable
expression ret.__expand_field_0
bug.d(5): Error: template instance
std.concurrency.receiveOnly!(immutable(string[string])) error instantiating

--
June 09, 2015
https://issues.dlang.org/show_bug.cgi?id=13930

Andrei Alexandrescu <andrei@erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unspecified                 |D2

--
December 25, 2016
https://issues.dlang.org/show_bug.cgi?id=13930

JR <zorael@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zorael@gmail.com

--- Comment #2 from JR <zorael@gmail.com> ---
Is there any easy workaround? Shared AAs can't be sent either[1].

[1]: http://melpon.org/wandbox/permlink/hoZTHJGgnWrnjxzw

--
October 08, 2020
https://issues.dlang.org/show_bug.cgi?id=13930

Tomoya Tanjo <ttanjo@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ttanjo@gmail.com

--- Comment #3 from Tomoya Tanjo <ttanjo@gmail.com> ---
I guess this issue contains two distinct problems.

The example in the first comment is about the problem of the `send` function. I guess it was already solved by issue 21296 because the following test works without errors (I used phobos commit:f85ca8db in which issue 21296 was fixed):

```
@system unittest
{
    immutable aa = ["0":0];
    thisTid.send(aa);
}
```


The example in the second comment is about the problem of the `receiveOnly`
function (same as issue 19345).
This problem only happens with `receiveOnly` but does not happen with other
`receive` family such as `receive` and `receiveTimeout`.
I confirmed the following tests work without errors (I used phobos
commit:f85ca8db):

```
@system unittest
{
    immutable aa = ["0":0];
    thisTid.send(aa);
    receive((immutable int[string] val) {});
}

@system unittest
{
    immutable aa = ["0":0];
    thisTid.send(aa);
    receiveTimeout(10.seconds, (immutable int[string] val) {});
}
```

Note: I did not test the case of shared.

--
October 09, 2020
https://issues.dlang.org/show_bug.cgi?id=13930

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
@tom-tan created dlang/phobos pull request #7655 "Fix `receiveOnly` for non-assignable types (issue 13930, issue 19345)" mentioning this issue:

- Fix receiveOnly for non-assignable types
  - Fix issue 13930 - std.concurrency can't send immutable AA to another thread
  - Fix issue 19345 - std.concurrency does not work with structs of const value
type

https://github.com/dlang/phobos/pull/7655

--
October 10, 2020
https://issues.dlang.org/show_bug.cgi?id=13930

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/phobos pull request #7655 "Fix issue 13930, 19345 - Fix `receiveOnly` for non-assignable types " was merged into master:

- d86c1f605995b423dd1a467b2c1c530dc52adb1e by Tomoya Tanjo:
  Fix issue 13930, 19345 - Fix receiveOnly for non-assignable types

https://github.com/dlang/phobos/pull/7655

--
October 10, 2020
https://issues.dlang.org/show_bug.cgi?id=13930

--- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/phobos pull request #7657 "Revert "Fix issue 13930, 19345 - Fix `receiveOnly` for non-assignable types "" was merged into master:

- 756242350896019ffc7a7cbe05e838538a559f5a by Mathias LANG:
  Revert "Fix issue 13930, 19345 - Fix receiveOnly for non-assignable types"

  This reverts commit 4f4fef19400ff85eb4699d569b02b21299b254cc.

https://github.com/dlang/phobos/pull/7657

--