On 13/05/2012, at 12:50 AM, john skaller wrote: > > On 13/05/2012, at 12:24 AM, john skaller wrote: >> >> Anyhow, Felix shouldn't terminate with the writer still on the >> fibre stack (the reader put it there when it read the channel). > > > Oh.. interesting. Very interesting!!
Oh yes, bitten by my semantics again. Dang that Cat, he is too smart, he used to belong to Schroedinger, that's the problem here: This fails to do what you expect. var x = mk_schannel[int](); proc reader() { println$ "R1 "; var u = read x; println$ "R2 "; u = read x; println$ "R3 "; } proc writer() { println$ "W1"; write (x,1); println$ "W2"; write (x,2); println$ "W3"; } spawn_fthread reader; spawn_fthread writer; print "Done"; endl; // OUTPUT: Done W1 R1 R2 R3 Weird eh? Three reads but only one write? How can that be?? Is it really reading or is there a bug? Lets add some debugging: var x = mk_schannel[int](); proc reader() { println$ "R1 "; var u = read x; println$ "R2 "+ str u; u = read x; println$ "R3 " + str u; } proc writer() { println$ "W1"; write (x,1); println$ "W2"; write (x,2); println$ "W3"; } spawn_fthread reader; spawn_fthread writer; print "Done"; endl; // OUTPUT: Done W1 R1 R2 1 W2 R3 2 W3 Crap! Now its working! What's going on? Where's the bug?? The bug is never there when you look for it. It's quantum mechanics. yes indeed! There's no bug. It's Schroedingers Cat playing with my mind. [Do you see the problem yet??] [No? Hint: what did I last improve in the compiler?] [Still don't see it? State Heisenberg's uncertainty principle and its obvious!] -- john skaller skal...@users.sourceforge.net http://felix-lang.org ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language