Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: 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
> simple.
>
> 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
do it.

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


Page was last modified "Jan 10 2012" The Rockbox Crew
aaa