[M3devel] solaris RTThread__Transfer?
Tony Hosking
hosking at cs.purdue.edu
Sun Feb 1 23:41:29 CET 2009
Sorry, I had mis-remembered that code as using swapcontext, which it
clearly does not.
I seem to recall that the longjmp emulation was necessary for some
reason, but I forget why right now. Was Transfer being called from
some place as if it was a longjmp?
Hmm...
It's been 10 years since I wrote that code for the Solaris port... ;-)
On 2 Feb 2009, at 01:11, Jay wrote:
>
> SOLgnu/SOLsun have this:
>
> void RTThread__Transfer (ucontext_t *from, ucontext_t *to)
> {
> if (getcontext(from) == 0) {
> to->uc_mcontext.gregs[REG_O0] = (greg_t)1; /* emulate longjmp
> return */
> setcontext(to); /* fire it up */
> }
> }
>
> Two questions:
> The longjmp emulation is unnecessary, right? (and platform specific)
> getcontext + setcontext could just be swapcontext, right?
>
>
> Specifically, the "entire function" could "just" be: (yeah yeah,
> only a slight reduction).
>
>
> void RTThread__Transfer (ucontext_t *from, ucontext_t *to)
> {
> swapcontext(from, to);
> }
>
>
> or even
>
>
> RTThread.i3
> PROCEDURE Transfer(...);
>
>
> Yes, I notice the error checking, but a) why would it ever fail b)
> is that really complete anyway?
> Just silently ignore the error?
>
>
> ?
> - Jay
More information about the M3devel
mailing list