Date: Fri, 16 Jan 1998 16:46:18 +1030 From: Greg Lehey <grog@lemis.com> To: Terry Lambert <tlambert@primenet.com> Cc: hackers@FreeBSD.ORG Subject: Re: Why no sys/setjmp.h? Message-ID: <19980116164618.38842@lemis.com> In-Reply-To: <199801160541.WAA23329@usr06.primenet.com>; from Terry Lambert on Fri, Jan 16, 1998 at 05:41:10AM %2B0000 References: <19980116123904.45753@lemis.com> <199801160541.WAA23329@usr06.primenet.com>
index | next in thread | previous in thread | raw e-mail
On Fri, Jan 16, 1998 at 05:41:10AM +0000, Terry Lambert wrote:
>>> In general, setjmp()/longjmp() prevent all sorts of optimizations
>>> from being used.
>>
>> In the kernel?
>
> In the compiler.
>
> No, I'm not saying the compiler knows about them, only that the programmer
> has to, and has to tell the compiler (via 'volatile') if -)2 or better
> is to work. Of course, it may be fixed in the most recent release.. we
> all know how goo ".0" releases are . 8-) 8-).
I understand the optimization issues which setjmp/longjmp bring with
them--see "Porting UNIX Software", page 226-229 for a discussion. My
question is, to what extent is this relevant in a kernel context? And
yes, of course, the programmer needs to know how to program.
>>> Finally, the purpose of these functions is to allow the throwing of
>>> exceptions, and the kernel has it's own exception mechanisms.
>>
>> Which are? That was my question.
>
> Using tsleep()/wakeup(), for one. Any set of operations can be reduced.
OK. I have a situation where I discover an error in the middle of a
relatively complicated function. I can see two possibilities to solve
it:
1. Return -1 or some such, and test every function call within this
part of the code. A lot of code.
2. longjmp () out of the code.
Could you explain how to use tsleep()/wakeup() to perform this
function?
Greg
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980116164618.38842>
