summaryrefslogtreecommitdiffstats
path: root/firmware/events.c
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2008-03-17 05:22:53 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2008-03-17 05:22:53 +0000
commita67e5d89efe6c3fcf5a2eaf27aac1c14f024ee27 (patch)
tree2e62c72ea2e45410216bdbd62b70101db0f4e7ca /firmware/events.c
parentc6b6bad18fcd68182574086c2eb2a1da30d36d25 (diff)
downloadrockbox-a67e5d89efe6c3fcf5a2eaf27aac1c14f024ee27.tar.gz
rockbox-a67e5d89efe6c3fcf5a2eaf27aac1c14f024ee27.tar.bz2
rockbox-a67e5d89efe6c3fcf5a2eaf27aac1c14f024ee27.zip
It makes more sense for the callback registrar to decide if its a "oneshot" then the callback caller.
(Doing it this way means playback could(/should?) registar a disk spinup callback at init which is called every spinup without needing to be reregistered) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16685 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/events.c')
-rw-r--r--firmware/events.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/firmware/events.c b/firmware/events.c
index eaf2e5c352..00c0099bb9 100644
--- a/firmware/events.c
+++ b/firmware/events.c
@@ -23,12 +23,13 @@
struct sysevent {
unsigned short id;
+ bool oneshot;
void (*callback)(void *data);
};
struct sysevent events[MAX_SYS_EVENTS];
-bool add_event(unsigned short id, void (*handler))
+bool add_event(unsigned short id, bool oneshot, void (*handler))
{
int i;
@@ -45,6 +46,7 @@ bool add_event(unsigned short id, void (*handler))
if (events[i].callback == NULL)
{
events[i].id = id;
+ events[i].oneshot = oneshot;
events[i].callback = handler;
return true;
}
@@ -70,7 +72,7 @@ void remove_event(unsigned short id, void (*handler))
panicf("event not found");
}
-void send_event(unsigned short id, bool oneshot, void *data)
+void send_event(unsigned short id, void *data)
{
int i;
@@ -80,7 +82,7 @@ void send_event(unsigned short id, bool oneshot, void *data)
{
events[i].callback(data);
- if (oneshot)
+ if (events[i].oneshot)
events[i].callback = NULL;
}
}