Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!apple!usc!zaphod.mps.ohio-state.edu!sdd.hp.com!elroy.jpl.nasa.gov!ncar!mephisto!bloom-beacon!eru!luth!sunic!mcsun!ukc!edcastle!dcl-cs!aber-cs!athene!pcg From: pcg@cs.aber.ac.uk (Piercarlo Grandi) Newsgroups: comp.lang.scheme Subject: Re: technical implementation details in language interface Message-ID: Date: 28 Aug 90 15:24:40 GMT References: <9008231801.AA27169@schizo> Sender: pcg@aber-cs.UUCP Organization: Coleg Prifysgol Cymru Lines: 35 In-reply-to: peter@ficc.ferranti.com's message of 24 Aug 90 11:36:04 GMT On 24 Aug 90 11:36:04 GMT, peter@ficc.ferranti.com (Peter da Silva) said: peter> In article <9008231801.AA27169@schizo> gjc@mitech.com writes: [ ... something about XtAppMainLoop and XtAppAddWorkProc and solving the callback problem in X by a call/cc style of doing things ... ] peter> Ack. So the solution to programming in X is to install a peter> mid-70s-Forth style non-pre-emptive O/S in every application. Why peter> not go all the way and implement threads? Alleluiah! peter> (Personally, I'd like to see threads become a relatively common peter> part of C runtimes. The mechanism required to implement threads peter> should also open the door to CALL/CC and all sorts of other peter> interesting constructs. Actually, it is exactly the viceversa, because... peter> (I would guess off the top of my head that doing threads on top peter> of call/cc would be a snap) ... is the *only* way. To have threads, you *must* have continuations. Look at it this way: a control switch is just saving the current continuation and continuing to another one. The same is a wait on a semaphore; you attach the current continuation to the semaphore queue, and continue to a new one detached from the cpu queue. Processes never "sleep" on a semaphore or "wait" to be run; you only have continuations, some of which may be assigned to a CPU and thus making progress in real time, and some not. That's all; just continuation passing. -- Piercarlo "Peter" Grandi | ARPA: pcg%uk.ac.aber.cs@nsfnet-relay.ac.uk Dept of CS, UCW Aberystwyth | UUCP: ...!mcsun!ukc!aber-cs!pcg Penglais, Aberystwyth SY23 3BZ, UK | INET: pcg@cs.aber.ac.uk