[movitz-devel] Re: yield stuff in threads.lisp

Frode Vatvedt Fjeld frodef at cs.uit.no
Mon Oct 24 19:43:51 UTC 2005


Shawn Betts <sabetts at vcn.bc.ca> writes:

> could you give an explanation of the yield stuff in the threads.lisp
> file? Is that what needs to be called to "stop" a thread?

I suppose it's described more accurately as "starting" another
thread. I.e. the thread that calls yield is suspended, and the thread
that is passed as argument to yield is resumed.

You can even do this interactively, i.e. someting like

  (setf *t1*) (current-run-time-context))
  (setf *t2* (make-instance 'threading:thread))
  (threading:yield *t2*)

    [now you're in t2.. try e.g a backtrace]

  (threading:yield *t1*)

    [now you're back to the context of the first yield.. i.e. it'll be
     just as if the first call to yield just returned.]


Execpt, of course, right now there are some lingering bugs that
prevents this from working. I'll try to have it fixed this evening.

-- 
Frode Vatvedt Fjeld




More information about the movitz-devel mailing list