confusing code....whats the point of this construct ?

Valdis.Kletnieks at vt.edu Valdis.Kletnieks at vt.edu
Wed Mar 11 14:57:31 EDT 2015


On Wed, 11 Mar 2015 18:37:32 -0000, Jeff Haran said:

> I don't understand the problem here. The caller passes in a condition to be
> evaluated in a loop. Many times that condition is quite simple (e.g. a counter
> being non-zero). If it was a function the caller would have to pass in a
> pointer to a function that does the evaluation, as in:

We do pointers to callback functions all the time.  We try *really* hard
to avoid anonymous lambda functions (which is basically what we have here).

The problem here is that there's about 3 zillion ways to screw up the inline
version, starting with the compiler optimizing the control variable into a
hoisted load outside the loop and causing the test to always fail - note that
the macro does *not* use any barriers or volatile or anything like that.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 848 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150311/0de6ac06/attachment.bin 


More information about the Kernelnewbies mailing list