Re: yield stuff in threads.lisp

Frode Vatvedt Fjeld <[email protected]> 24 Oct 2005 21:43:51 +0200
Newsgroups gmane.lisp.movitz.devel
Message-ID <[email protected]>
Shawn Betts <[email protected]> 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