September 08, 2015 Concurency wtf? | ||||
---|---|---|---|---|
| ||||
I can't seem to receive certain messages, my code is very simple and it all works except for receiving: in one thread I do locate("MyMonitor").send(cast(shared)pt); which sends the message(pt is a windows POINT structure). In the MyMonitor spawned thread, I have while (true) { POINT y; receiveTimeout(100.msecs, (POINT p) { y = p; } ); Thread.sleep(100.msecs); continue; } Note that everything works except the matching in receiveTimeout. (I've tired various things and simplifications to no avail). I can send simple types like int and bool. e.g., sending a literal works fine. My guess is the shared is causing problems but I've tried all common sense combinations. But I have to send shared, else send complains about sending unshared types. Of course, the great thing is, all examples use literals and hence not real world examples(isn't that nice?). Please don't ask me to provide source. The issue has nothing to do with the other code but specifically the TYPE that is being sent. Works for some types and not others. It is almost surely due to the shared issue, any ideas? |
September 08, 2015 Re: Concurency wtf? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Prudence | On 9/8/15 2:54 PM, Prudence wrote: > > I can't seem to receive certain messages, my code is very simple and it > all works except for receiving: > > > in one thread I do > > > locate("MyMonitor").send(cast(shared)pt); You are casting to shared here. > > which sends the message(pt is a windows POINT structure). > > In the MyMonitor spawned thread, I have > > > while (true) > { > POINT y; > receiveTimeout(100.msecs, > (POINT p) But not receiving a shared(POINT) here. So the types are different. What is a POINT struct? If it's simple POD (with no pointers), then you don't need the shared type modifier. -Steve |
Copyright © 1999-2021 by the D Language Foundation