OK it seems wierd On Tue, Feb 9, 2016 at 4:52 PM, Daniel Kozak <kozz...@gmail.com> wrote:
> It is OK, I guess the output is just mixed > > On Tue, Feb 9, 2016 at 4:35 PM, miazo via Digitalmars-d-learn < > digitalmars-d-learn@puremagic.com> wrote: > >> Hi, >> >> The following simple program: >> >> import std.stdio, std.concurrency; >> >> void f1() { >> writeln("owner: ", ownerTid); >> writeln("worker: ", thisTid); >> } >> >> void main() { >> writeln("owner: ", thisTid); >> writeln("worker: ", spawn(&f1)); >> } >> >> Gives me the following result: >> >> owner: Tid(18fd58) >> worker: Tid(18fd58) >> owner: Tid(24afe38) >> worker: Tid(24afe38) >> >> Is it correct? My expectation was that: >> - thisTid called from main will be the same as ownerTid called from f1 >> - thisTid called from f1 will be the same as value returned by spawn() >> >> Thank you for your help. >> >> >