sending the address of a struct

2020-09-06 Thread Johann Lermer via Digitalmars-d-learn
Hi, I have a struct in a separate thread and want to pass it's address back to the main thread. This is how I think it should work: import std.concurrency; struct Env {} void run () { shared Env env; ownerTid.send (&env); for (;;) {} } void main () { spawn (

Re: sending the address of a struct

2020-09-06 Thread Simen Kjærås via Digitalmars-d-learn
On Sunday, 6 September 2020 at 09:58:54 UTC, Johann Lermer wrote: pointer. The error message says: std.concurrency.MessageMismatch@std/concurrency.d(237): Unexpected message type: expected 'shared(Env*)', got 'shared(test.Env)*' The error message gives you all the information you need - noti

Re: Compile code for PowerNex OS

2020-09-06 Thread Dan Printzell via Digitalmars-d-learn
On Saturday, 5 September 2020 at 12:45:06 UTC, Quantium wrote: I have a code that I need to compile for PowerNex OS, which compiler should I use and how to compile code for PowerNex? Short version: You can't (right now). Long version: PowerNex is currently in broken development state so even i

Re: sending the address of a struct

2020-09-06 Thread Johann Lermer via Digitalmars-d-learn
On Sunday, 6 September 2020 at 11:10:14 UTC, Simen Kjærås wrote: auto e = receiveOnly!(shared(Env)*); Oh, thanks. Seems, that I just missed that bit with the pranetheses.

Re: tupleof seems to break encapsulation

2020-09-06 Thread Jacob Carlborg via Digitalmars-d-learn
On 2020-09-05 07:14, 60rntogo wrote: I wouldn't dispute that it is useful, but that's besides the point. If I declare something private, it's usually because I want to preserve certain invariants and I want the compiler to provide a guarantee that I don't accidentally violate them. As it stand