Date: Mon, 16 Jun 2003 18:55:44 -0700 (PDT) From: John Polstra <jdp@polstra.com> To: freebsd-threads@freebsd.org Subject: getcontext() for a different thread Message-ID: <XFMail.20030616185544.jdp@polstra.com>
next in thread | raw e-mail | index | archive | help
I've been toying with the idea of making Modula-3 use FreeBSD's native threads library. One thing that would be required is something like getcontext() that could be called to get the context of a different thread. That is needed by the garbage collector, because it has to examine all of the threads' registers in case some of them contain pointers to objects that need to be traced. Are there any major obstacles to implementing this? I see that getcontext() in the kernel already takes a "struct thread *" argument. But it calls get_mcontext(), which (at least on the i386) references "curthread" a couple of times. Is that really necessary, or could "td" be used in place of "curthread"? An other-thread getcontext would have to be passed a kernel thread handle of some sort. Is there currently anything like that which is exposed to userland? An other-thread getcontext would have to do some security checks to make sure you weren't trying to read the register of a thread that didn't belong to you. Anything else? John -- John Polstra John D. Polstra & Co., Inc. Seattle, Washington USA "Two buttocks cannot avoid friction." -- Malawi saying
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20030616185544.jdp>