aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2023-10-30 18:52:57 +0900
committer坂本 貴史 <o-takashi@sakamocchi.jp>2023-10-30 21:18:53 +0900
commit71eabc32edfdda22a9dc56f567a4668c4a76188c (patch)
treeff98d558e3d29ac1f60dcb43cd4eff6383d40ced
parent5c9e6d5065bd3400068ab91a484acc79a2c36fc9 (diff)
downloadlibhinoko-71eabc32edfdda22a9dc56f567a4668c4a76188c.tar.gz
fw_iso_resource_auto: remove async/sync suffixes from deallocation methods
The request of deallocation generates completion event. In current implementation, the method for request has async suffix, and the method to wait for the event has sync suffix. However, these two keywords are often heavy use in different contexts and sometimes unfriendly to developers and users. This commit renames these methods. The name of async method becomes simplier, and the sync method is suffixed with wait. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
-rwxr-xr-xsamples/iso-resource2
-rw-r--r--src/fw_iso_resource_auto.c15
-rw-r--r--src/fw_iso_resource_auto.h5
-rw-r--r--src/hinoko.map5
-rw-r--r--tests/fw-iso-resource-auto4
5 files changed, 15 insertions, 16 deletions
diff --git a/samples/iso-resource b/samples/iso-resource
index 6775379..6a17e0e 100755
--- a/samples/iso-resource
+++ b/samples/iso-resource
@@ -91,7 +91,7 @@ for i in range(2):
sleep(1)
try:
- res.deallocate_sync(100)
+ res.deallocate_wait(100)
except GLib.Error as e:
if e.matches(Hinoko.fw_iso_resource_error_quark(), Hinoko.FwIsoResourceError.EVENT):
print(e)
diff --git a/src/fw_iso_resource_auto.c b/src/fw_iso_resource_auto.c
index 4b435ba..2c249ce 100644
--- a/src/fw_iso_resource_auto.c
+++ b/src/fw_iso_resource_auto.c
@@ -360,7 +360,7 @@ HinokoFwIsoResourceAuto *hinoko_fw_iso_resource_auto_new()
}
/**
- * hinoko_fw_iso_resource_auto_deallocate_async:
+ * hinoko_fw_iso_resource_auto_deallocate:
* @self: A [class@FwIsoResourceAuto]
* @error: A [struct@GLib.Error]. Error can be generated with domains of [error@FwIsoResourceError],
* and [error@FwIsoResourceAutoError].
@@ -370,10 +370,9 @@ HinokoFwIsoResourceAuto *hinoko_fw_iso_resource_auto_new()
*
* Returns: TRUE if the overall operation finished successfully, otherwise FALSE.
*
- * Since: 0.7
+ * Since: 1.0
*/
-gboolean hinoko_fw_iso_resource_auto_deallocate_async(HinokoFwIsoResourceAuto *self,
- GError **error)
+gboolean hinoko_fw_iso_resource_auto_deallocate(HinokoFwIsoResourceAuto *self, GError **error)
{
HinokoFwIsoResourceAutoPrivate *priv;
struct fw_cdev_deallocate dealloc = {0};
@@ -412,7 +411,7 @@ end:
}
/**
- * hinoko_fw_iso_resource_auto_deallocate_sync:
+ * hinoko_fw_iso_resource_auto_deallocate_wait:
* @self: A [class@FwIsoResourceAuto]
* @timeout_ms: The timeout to wait for allocated event by milli second unit.
* @error: A [struct@GLib.Error]. Error can be generated with domains of [error@FwIsoResourceError],
@@ -423,9 +422,9 @@ end:
*
* Returns: TRUE if the overall operation finished successfully, otherwise FALSE.
*
- * Since: 0.7
+ * Since: 1.0
*/
-gboolean hinoko_fw_iso_resource_auto_deallocate_sync(HinokoFwIsoResourceAuto *self,
+gboolean hinoko_fw_iso_resource_auto_deallocate_wait(HinokoFwIsoResourceAuto *self,
guint timeout_ms, GError **error)
{
struct fw_iso_resource_waiter w;
@@ -436,7 +435,7 @@ gboolean hinoko_fw_iso_resource_auto_deallocate_sync(HinokoFwIsoResourceAuto *se
fw_iso_resource_waiter_init(&w, HINOKO_FW_ISO_RESOURCE(self), DEALLOCATED_SIGNAL_NAME,
timeout_ms);
- (void)hinoko_fw_iso_resource_auto_deallocate_async(self, error);
+ (void)hinoko_fw_iso_resource_auto_deallocate(self, error);
return fw_iso_resource_waiter_wait(&w, HINOKO_FW_ISO_RESOURCE(self), error);
}
diff --git a/src/fw_iso_resource_auto.h b/src/fw_iso_resource_auto.h
index b42a7be..cc5f7be 100644
--- a/src/fw_iso_resource_auto.h
+++ b/src/fw_iso_resource_auto.h
@@ -21,9 +21,8 @@ struct _HinokoFwIsoResourceAutoClass {
HinokoFwIsoResourceAuto *hinoko_fw_iso_resource_auto_new(void);
-gboolean hinoko_fw_iso_resource_auto_deallocate_async(HinokoFwIsoResourceAuto *self,
- GError **error);
-gboolean hinoko_fw_iso_resource_auto_deallocate_sync(HinokoFwIsoResourceAuto *self,
+gboolean hinoko_fw_iso_resource_auto_deallocate(HinokoFwIsoResourceAuto *self, GError **error);
+gboolean hinoko_fw_iso_resource_auto_deallocate_wait(HinokoFwIsoResourceAuto *self,
guint timeout_ms, GError **error);
G_END_DECLS
diff --git a/src/hinoko.map b/src/hinoko.map
index 51ca525..98237d7 100644
--- a/src/hinoko.map
+++ b/src/hinoko.map
@@ -45,8 +45,6 @@ HINOKO_0_7_0 {
"hinoko_fw_iso_resource_allocate_sync";
"hinoko_fw_iso_resource_auto_get_type";
- "hinoko_fw_iso_resource_auto_deallocate_async";
- "hinoko_fw_iso_resource_auto_deallocate_sync";
"hinoko_fw_iso_resource_once_get_type";
"hinoko_fw_iso_resource_once_new";
@@ -83,4 +81,7 @@ HINOKO_0_9_0 {
HINOKO_1_0_0 {
"hinoko_fw_iso_resource_once_deallocate";
"hinoko_fw_iso_resource_once_deallocate_wait";
+
+ "hinoko_fw_iso_resource_auto_deallocate";
+ "hinoko_fw_iso_resource_auto_deallocate_wait";
} HINOKO_0_9_0;
diff --git a/tests/fw-iso-resource-auto b/tests/fw-iso-resource-auto
index 7242586..faf8e43 100644
--- a/tests/fw-iso-resource-auto
+++ b/tests/fw-iso-resource-auto
@@ -19,8 +19,8 @@ props = (
)
methods = (
'new',
- 'deallocate_async',
- 'deallocate_sync',
+ 'deallocate',
+ 'deallocate_wait',
# From interface.
'open',
'create_source',