aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorJanos Kovacs <janos.f.kovacs@nokia.com>2010-02-18 23:17:25 +0200
committerJanos Kovacs <janos.f.kovacs@nokia.com>2010-02-18 23:17:25 +0200
commit13ff8a88309543069bd9c4ca655dcf405ced3fb0 (patch)
treed88b54bc630ea85044d235445e8c41b3fe14dd15 /examples
parent091e9a075f4c934568c638fb09e4833b2bece781 (diff)
high level C API:
- completing the implementation of the destructor - fixes for several memory leaks - fmradio example is extended to test the destruction
Diffstat (limited to 'examples')
-rw-r--r--examples/fmradio.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/examples/fmradio.c b/examples/fmradio.c
index d2bf0b0..3c0ff53 100644
--- a/examples/fmradio.c
+++ b/examples/fmradio.c
@@ -15,6 +15,8 @@ static void run_mainloop (void);
static void grant_callback (resource_set_t *, uint32_t, void *);
static void advice_callback (resource_set_t *, uint32_t, void *);
+static void schedule_destruction (resource_set_t *, guint);
+static gboolean destructor (void *);
int main (int argc, char **atgv)
{
@@ -28,6 +30,8 @@ int main (int argc, char **atgv)
resource_set_configure_audio (resource_set, "fmradio", 0,NULL);
resource_set_acquire (resource_set);
+ schedule_destruction (resource_set, 20);
+
run_mainloop ();
resource_set_destroy (resource_set);
@@ -82,6 +86,22 @@ static void advice_callback (resource_set_t *resource_set,
}
+static void schedule_destruction (resource_set_t *resource_set, guint seconds)
+{
+ g_timeout_add (seconds * 1000, destructor, resource_set);
+}
+
+static gboolean destructor (void *data)
+{
+ resource_set_t *resource_set = data;
+
+ resource_set_destroy (resource_set);
+
+ return FALSE;
+}
+
+
+
/*
* Local Variables:
* c-basic-offset: 4