Rockbox mail archiveSubject: Re: 1 standard generic callback system
Re: 1 standard generic callback system
From: Jonathan Gordon <jdgordy_at_gmail.com>
Date: Wed, 6 Jun 2007 10:58:22 +1000
On 06/06/07, Linus Nielsen Feltzing <linus_at_haxx.se> wrote:
> Jonathan Gordon wrote:
> > Questions, comments?
> I think it sounds like a good idea. The implementation looks clean and
> 1) Why this:
> +#define register_ata_idle_func(f) \
> + register_event_callback(EID_ATA_DISK_SPINUP, (event_callback)f)
> Why not replace the calls in the ATA code?
because I just wanted to get it up and running, in the finished
version this wont be there.
> 2) Question:
> > + if (run)
> > + callbacks[i].function(NULL);
> Is it always true that the callback wants a NULL argument in this case?
from the event_callback.h file "/* run - call the callback before removing
it from the list, data will always be NULL */, this has to be
done because usually data would be a pointer to some meaningful data
for the event (the id3 struct for the current track possibly?) but
becuase its impossible to know what to pass, NULL is the safest way to
Also, I made a sight mistake, in the svn ata callback stuff registered
callbacks only get called once, so an extra param needs to be added to
the register function to say weather to call it once or every time.
Received on 2007-06-06