[M3devel] solaris RTThread__Transfer?
Jay
jay.krell at cornell.edu
Mon Feb 2 00:14:32 CET 2009
> sorry
No problem. I just want to understand, if possible, for when I handle other platforms.
> Was Transfer being called from some place as if it was a longjmp?
I don't think so but I'll double check.
The primary use of it I think ignores the return value.
Thanks,
- Jay
----------------------------------------
> From: hosking at cs.purdue.edu
> To: jay.krell at cornell.edu
> Date: Mon, 2 Feb 2009 09:41:29 +1100
> CC: m3devel at elegosoft.com
> Subject: Re: [M3devel] solaris RTThread__Transfer?
>
> 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