Thread fails to start
Sean Kelly
sean at invisibleduck.org
Sun Jan 2 16:37:59 PST 2011
Adam Conner-Sax Wrote:
> Thanks for trying it!
>
> I've seen that outcome once also but usually I don't get the "in produce(...)"
> when it hangs. And I don't get the bus errors (I've gotten them other ways).
>
> I get that I should use spawn (and I am writing a new version to use spawn
> everywhere), though I did make it all work without ever using spawn so the mailbox
> setup seems to work anyway though I do not understand how. Are both (from spawner
> to spawnee and vice versa) mailboxes set up by spawn? How does the unit test in
> std.concurrency work? It spawns but then sends messages in both directions.
spawn creates the mailbox in the new thread. I'm going to change thisTid to create a mailbox for the current thread if none exists though. That should resolve the issue I mentioned earlier. The main thread gets a mailbox by default, if I remember correctly. I just didn't want to give other threads one by default because the ref is immediately overwritten by spawn.
> If I get the error on a smaller subset I will post. It was all working then at
> some point as I was moving toward the std.concurrency way, it all broke in the way
> I described so I don't know how to make a smaller version that also has the error.
I'll try to find some time to give your code a closer look. It seems like it could be used as a more thorough test suite for the thread and messaging code.
More information about the Digitalmars-d
mailing list