On Fri, Dec 19, 2008 at 06:12:51AM +0000, James Mansion
<[email protected]> wrote:
> That's not necessarily true. Just have a signal byte at a known offset
First of all, please do other people a favour and don't send such horribly
misformatted messages like yours. Remember that other people might want
to read your e-mails, and making it needlessly hard for them is just
pointless.
> and require it to be 0 to
> do the initialisation, and the initialisationn will change the signal.
You are arguing in circles - requiring it to be zero means it needs ot be
*initialised* first.
So your argument boils down to: to avoid having to initialise the watcher
seperately, you need to initialise it first.
But that's exactly what the intialise function is for.
> This is low overhead on users and runtime - but it IS an API change. To
> say its not possible in general is wrong, though.
It is also stupid - it would require *two* initialisation functions, one
that sets that magic byte to zero, and one that, well, initialiases the
rest of the structure.
All you would gain would be more complexity.
> And, to be honest, having an *optional*check that looks in memory and
> says 'if it looks initialised, then it IS in itialised' and accepts a
> probabilistic false positive, is also cheap and unlikely
Unfortunately, such a check is not possible in C.
In addition, it would be stupid - looking at some structure to see if it
*might* be valid is the worst ting you can do (as opposed to looking at a
structure to see if it *is* invalid, which is what libev does).
> to be a problem in reality while catching a class of bug. (Though, you
> might want to increase
> the size of the structure slightly to have a magic flag - 64 bits or so
> perhaps).
Remember that this magic byte thing also requires another deinitialisation
function that makes that memory reusable again, which you *need* to call
before freeing the memory, so again, you would lose considerably.
--
The choice of a Deliantra, the free code+content MORPG
-----==- _GNU_ http://www.deliantra.net
----==-- _ generation
---==---(_)__ __ ____ __ Marc Lehmann
--==---/ / _ \/ // /\ \/ / [email protected]
-=====/_/_//_/\_,_/ /_/\_\
_______________________________________________
libev mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev