digitalmars.D.learn - What wrong?
- Fyodor Ustinov (13/13) May 01 2015 Simple code:
- Dennis Ritchie (68/81) May 02 2015 I think the problem is in these lines:
- Fyodor Ustinov (3/28) May 02 2015 I see it by the lack of "42". :)
- Dennis Ritchie (3/5) May 02 2015 Report, please, about it (D)evepopers :)
- Fyodor Ustinov (3/9) May 03 2015 I'm not sure that it's not my fault. So I hope that will come by
- Dennis Ritchie (4/7) May 03 2015 OK. But if one does not come within three days :), duplicate
- sclytrack (42/48) May 05 2015 import std.stdio;
- sclytrack (24/31) May 14 2015 import std.stdio;
- thedeemon (7/10) May 15 2015 Try using class instead of struct.
- Gary Willoughby (2/14) May 15 2015 Please raise a bugzilla issue for this.
- Daniel Kozak (4/19) May 15 2015 this commit cause the issue:
- anonymous (6/19) May 15 2015 (Copying my reply to the post in the main group here:)
Simple code: http://pastebin.com/raw.php?i=7jVeMFXQ This code works compiled by DMD v2.066.1 and LDC2 (0.15.1) based on DMD v2.066.1 and LLVM 3.5.0. $ ./z TUQLUE 42 11 Compiled by DMD v2.067.1 the program crashes: $ ./aa TUQLUE Segmentation fault What I'm doing wrong?
May 01 2015
On Saturday, 2 May 2015 at 02:51:52 UTC, Fyodor Ustinov wrote:Simple code: http://pastebin.com/raw.php?i=7jVeMFXQ This code works compiled by DMD v2.066.1 and LDC2 (0.15.1) based on DMD v2.066.1 and LLVM 3.5.0. $ ./z TUQLUE 42 11 Compiled by DMD v2.067.1 the program crashes: $ ./aa TUQLUE Segmentation fault What I'm doing wrong?I think the problem is in these lines: ----- receive( (supervisorAnswer a) => r = a.ret ); Partially it works :) ----- import std.variant; private struct Exit{}; private struct supervisorAnswer { Variant ret; } private __gshared Tid supervisorTid; private void supervisor() { static Variant[string] zval; bool done = false; void _store(T)(string k, T v) { assert(k.length > 0); zval[k] = v; } void _get(Tid id, string k) { id.send(supervisorAnswer(zval.get(k, Variant("NOTFOUND")))); } while (!done) { supervisorAnswer answer; receive( (Exit s) { done = true; }, &_store!long, &_store!ulong, &_store!int, &_store!uint, &_store!float, &_store!double, &_store!string, &_store!Variant, &_get, (Variant e) { writeln(e); }, ); } } Variant Get(const string s) { Variant r; supervisorTid.send(thisTid, s); writeln("TUQLUE"); /*receive( (supervisorAnswer a) => r = a.ret );*/ writeln("42"); return r; } void Set(T)(const string s, T v) { supervisorTid.send(s, v); } shared static this() { supervisorTid = spawn(&supervisor); } shared static ~this() { send(supervisorTid, Exit()); } void main() { Set("1", 11); writeln(Get("1")); send(supervisorTid, Exit()); thread_joinAll(); }
May 02 2015
On Saturday, 2 May 2015 at 19:13:45 UTC, Dennis Ritchie wrote:On Saturday, 2 May 2015 at 02:51:52 UTC, Fyodor Ustinov wrote:I see it by the lack of "42". :) But why is this "receive" breaks down?Simple code: http://pastebin.com/raw.php?i=7jVeMFXQ This code works compiled by DMD v2.066.1 and LDC2 (0.15.1) based on DMD v2.066.1 and LLVM 3.5.0. $ ./z TUQLUE 42 11 Compiled by DMD v2.067.1 the program crashes: $ ./aa TUQLUE Segmentation fault What I'm doing wrong?I think the problem is in these lines: ----- receive( (supervisorAnswer a) => r = a.ret ); Partially it works :)
May 02 2015
On Saturday, 2 May 2015 at 19:38:01 UTC, Fyodor Ustinov wrote:I see it by the lack of "42". :) But why is this "receive" breaks down?Report, please, about it (D)evepopers :) https://issues.dlang.org/
May 02 2015
On Saturday, 2 May 2015 at 20:46:32 UTC, Dennis Ritchie wrote:On Saturday, 2 May 2015 at 19:38:01 UTC, Fyodor Ustinov wrote:I'm not sure that it's not my fault. So I hope that will come by knowledgeable people and say "Hey, buddy, your mistake is..." :)I see it by the lack of "42". :) But why is this "receive" breaks down?Report, please, about it (D)evepopers :) https://issues.dlang.org/
May 03 2015
On Monday, 4 May 2015 at 01:03:43 UTC, Fyodor Ustinov wrote:I'm not sure that it's not my fault. So I hope that will come by knowledgeable people and say "Hey, buddy, your mistake is..." :)OK. But if one does not come within three days :), duplicate topic in this section: http://forum.dlang.org/group/digitalmars.D
May 03 2015
On Monday, 4 May 2015 at 01:03:43 UTC, Fyodor Ustinov wrote:On Saturday, 2 May 2015 at 20:46:32 UTC, Dennis Ritchie wrote:import std.stdio; import std.concurrency; struct Answer { int number = 10; ~this() { writeln(number); } } void threadRoutine() { receive( (int value){ } //handle question ); ownerTid.send( Answer() ); //answer } void main() { Tid childId = spawn(&threadRoutine); childId.send(100); //question receive((Answer t) {}); //answer } //DMD64 D Compiler v2.067.1 /* 10 10 10 10 10 10 10 10 10 10 10 7080544 10 10 10 */On Saturday, 2 May 2015 at 19:38:01 UTC, Fyodor Ustinov wrote:I see it by the lack of "42". :) But why is this "receive" breaks down?
May 05 2015
On Tuesday, 5 May 2015 at 07:41:04 UTC, sclytrack wrote:On Monday, 4 May 2015 at 01:03:43 UTC, Fyodor Ustinov wrote:import std.stdio; import std.variant; struct SoMany { int number = 10; ~this() { writeln(number); } } void main() { Variant v = SoMany(); } DMD64 D Compiler v2.067.1 10 10 10 10 gdc (Debian 4.9.2-10) 4.9.2 10 10 For DMD I'm getting 4x10 and for gdc 2x10On Saturday, 2 May 2015 at 20:46:32 UTC, Dennis Ritchie wrote:On Saturday, 2 May 2015 at 19:38:01 UTC, Fyodor Ustinov wrote:I see it by the lack of "42". :) But why is this "receive" breaks down?
May 14 2015
On Saturday, 2 May 2015 at 02:51:52 UTC, Fyodor Ustinov wrote:Simple code: http://pastebin.com/raw.php?i=7jVeMFXQ What I'm doing wrong?Try using class instead of struct. Last time I played with std.concurrency it used Variants to store the messages, so when something bigger than a little basic value or a reference, like a class object, is sent it behaves unpredictably: can crash or shit garbage. Trying to send structs larger than ~20 bytes usually caused problems.
May 15 2015
On Friday, 15 May 2015 at 07:51:29 UTC, thedeemon wrote:On Saturday, 2 May 2015 at 02:51:52 UTC, Fyodor Ustinov wrote:Please raise a bugzilla issue for this.Simple code: http://pastebin.com/raw.php?i=7jVeMFXQ What I'm doing wrong?Try using class instead of struct. Last time I played with std.concurrency it used Variants to store the messages, so when something bigger than a little basic value or a reference, like a class object, is sent it behaves unpredictably: can crash or shit garbage. Trying to send structs larger than ~20 bytes usually caused problems.
May 15 2015
On Friday, 15 May 2015 at 09:20:32 UTC, Gary Willoughby wrote:On Friday, 15 May 2015 at 07:51:29 UTC, thedeemon wrote:this commit cause the issue: https://github.com/D-Programming-Language/phobos/commit/45fda72192ff5b878ebe915db0ffb9f6504cca8f but it is probably just a trigger not a real cause.On Saturday, 2 May 2015 at 02:51:52 UTC, Fyodor Ustinov wrote:Please raise a bugzilla issue for this.Simple code: http://pastebin.com/raw.php?i=7jVeMFXQ What I'm doing wrong?Try using class instead of struct. Last time I played with std.concurrency it used Variants to store the messages, so when something bigger than a little basic value or a reference, like a class object, is sent it behaves unpredictably: can crash or shit garbage. Trying to send structs larger than ~20 bytes usually caused problems.
May 15 2015
On Saturday, 2 May 2015 at 02:51:52 UTC, Fyodor Ustinov wrote:Simple code: http://pastebin.com/raw.php?i=7jVeMFXQ This code works compiled by DMD v2.066.1 and LDC2 (0.15.1) based on DMD v2.066.1 and LLVM 3.5.0. $ ./z TUQLUE 42 11 Compiled by DMD v2.067.1 the program crashes: $ ./aa TUQLUE Segmentation fault What I'm doing wrong?(Copying my reply to the post in the main group here:) I investigated this further. std.variant is to blame. I filed an issue an made a pull request to fix it: https://issues.dlang.org/show_bug.cgi?id=14585 https://github.com/D-Programming-Language/phobos/pull/3284
May 15 2015