From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: Date: Mon, 26 Sep 2005 14:52:59 -0400 From: Russ Cox To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Subject: Re: [9fans] thread confusion In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <200509212025.j8LKPdr29497@demeter.cs.utwente.nl> Topicbox-Message-UUID: 9150c25a-ead0-11e9-9d60-3106f5b1d025 What if we did without the timer variable? alt { x =3D <-c =3D> print("%d\n", x); timeout 1 =3D> print("1 second passed\n"); } You could model the timer variable easily enough: t :=3D time()+10; for(;;){ alt { x =3D <-c =3D> print("%d\n", x); timeout t-time() =3D> print("10 seconds passed\n"); break; } } which do you think would be more common? I think the former, hence the dropping of explicit timer variables. Once you've figured out what a good interface is, implementing it is subtle and difficult to get right. But it only needs to be done right once and then everyone benefits. Channel communication is complicated too under the hood, but it's still a good abstraction. Russ