Struggling with shared objects
anonymous via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Jan 17 13:45:10 PST 2015
On Saturday, 17 January 2015 at 21:00:34 UTC, Mike wrote:
> Hey, all.
>
> I have just started using D and I'm really loving it, but I have
> been caught on a problem.
> I am trying to share my Client class to a new thread, and after
> a
> bit of struggling: I finally got the code to compile!
>
> Now I am having a new problem: the moment I call
> "client.receive(buf)" I get an error:
> D:\D\dmd2\src\phobos\std\concurrency.d(13,13): Error: static
> assert (false || false) is false (StompBroker)
>
> I assume it has something to do with the way I am handling the
> shared keyword along with pointers, but I cannot for the life of
> me figure this out!
>
> Any help is appreciated. Thank you!
>
> Code: https://github.com/mvlipka/StompBroker
I don't get what `auto message = client.receive(buf);` is
supposed to call exactly.
If you mean to call std.concurrency.receive [1], it's way off.
That's what the error message complains about.
If you mean to call a method of Client, well it doesn't have a
`receive` method.
Also, you have too many asterisks (*). Classes already have
reference semantics in D. There's no need for `Socket*` or
`Client`. Just use `Socket` and `Client`.
[1] http://dlang.org/phobos/std_concurrency#.receive
More information about the Digitalmars-d-learn
mailing list