]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
timer: user_instance: add GObject signal to handle disconnection of the attached...
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sun, 9 Feb 2020 03:20:53 +0000 (12:20 +0900)
committer坂本 貴史 <o-takashi@sakamocchi.jp>
Tue, 11 Feb 2020 04:28:18 +0000 (13:28 +0900)
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
src/timer/user-instance.c
tests/alsatimer-user-instance

index 4f129488c7b9d989b7a6fc2db001dc965f1ab4cd..8e6e845869018e5cb984c1e2aa2d56d07fed7e10 100644 (file)
@@ -27,6 +27,7 @@ typedef struct {
 
 enum timer_user_instance_sig_type {
     TIMER_USER_INSTANCE_SIG_HANDLE_EVENT = 0,
+    TIMER_USER_INSTANCE_SIG_HANDLE_DISCONNECTION,
     TIMER_USER_INSTANCE_SIG_COUNT,
 };
 static guint timer_user_instance_sigs[TIMER_USER_INSTANCE_SIG_COUNT] = { 0 };
@@ -64,6 +65,24 @@ static void alsatimer_user_instance_class_init(ALSATimerUserInstanceClass *klass
                      NULL, NULL,
                      g_cclosure_marshal_VOID__OBJECT,
                      G_TYPE_NONE, 1, ALSATIMER_TYPE_EVENT_DATA);
+
+    /**
+     * ALSATimerUserInstance::handle-disconnection:
+     * @self: A #ALSATimerUserInstance.
+     *
+     * When the attached timer device is not available anymore due to unbinding
+     * driver or hot unplugging, this signal is emit. The owner of this object
+     * should call g_object_free() as quickly as possible to release ALSA timer
+     * character device.
+     */
+    timer_user_instance_sigs[TIMER_USER_INSTANCE_SIG_HANDLE_DISCONNECTION] =
+        g_signal_new("handle-disconnection",
+                     G_OBJECT_CLASS_TYPE(klass),
+                     G_SIGNAL_RUN_LAST,
+                     0,
+                     NULL, NULL,
+                     g_cclosure_marshal_VOID__VOID,
+                     G_TYPE_NONE, 0, G_TYPE_NONE, 0);
 }
 
 static void alsatimer_user_instance_init(ALSATimerUserInstance *self)
index 3140cea13b4ee0ebd887f937077529aca03f6842..f74fa21aed223c35dbe58832225d6670d1eedd08 100644 (file)
@@ -24,6 +24,7 @@ methods = (
 )
 signals = (
     'handle-event',
+    'handle-disconnection',
 )
 
 if not test(target, props, methods, signals):