Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wireplumber
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pkg
wireplumber
Commits
a10ee91b
Commit
a10ee91b
authored
4 years ago
by
George Kiagiadakis
Browse files
Options
Downloads
Patches
Plain Diff
core: add idle & timeout method variants that take a GClosure
parent
6501307d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/wp/core.c
+59
-1
59 additions, 1 deletion
lib/wp/core.c
lib/wp/core.h
+9
-1
9 additions, 1 deletion
lib/wp/core.h
with
68 additions
and
2 deletions
lib/wp/core.c
+
59
−
1
View file @
a10ee91b
...
...
@@ -495,6 +495,34 @@ wp_core_idle_add (WpCore * self, GSource **source, GSourceFunc function,
*
source
=
g_source_ref
(
s
);
}
/**
* wp_core_idle_add_closure: (rename-to wp_core_idle_add)
* @self: the core
* @source: (out) (optional): the source
* @closure: the closure to invoke
*
* Adds an idle callback to be called in the same #GMainContext as the
* one used by this core.
*
* This is the same as wp_core_idle_add(), but it allows you to specify
* a #GClosure instead of a C callback.
*/
void
wp_core_idle_add_closure
(
WpCore
*
self
,
GSource
**
source
,
GClosure
*
closure
)
{
g_autoptr
(
GSource
)
s
=
NULL
;
g_return_if_fail
(
WP_IS_CORE
(
self
));
g_return_if_fail
(
closure
!=
NULL
);
s
=
g_idle_source_new
();
g_source_set_closure
(
s
,
closure
);
g_source_attach
(
s
,
self
->
context
);
if
(
source
)
*
source
=
g_source_ref
(
s
);
}
/**
* wp_core_timeout_add:
* @self: the core
...
...
@@ -513,7 +541,7 @@ wp_core_idle_add (WpCore * self, GSource **source, GSourceFunc function,
* used by this core instead of the default context.
*/
void
wp_core_timeout_add
(
WpCore
*
self
,
GSource
**
source
,
guint
64
timeout_ms
,
wp_core_timeout_add
(
WpCore
*
self
,
GSource
**
source
,
guint
timeout_ms
,
GSourceFunc
function
,
gpointer
data
,
GDestroyNotify
destroy
)
{
g_autoptr
(
GSource
)
s
=
NULL
;
...
...
@@ -528,6 +556,36 @@ wp_core_timeout_add (WpCore * self, GSource **source, guint64 timeout_ms,
*
source
=
g_source_ref
(
s
);
}
/**
* wp_core_timeout_add_closure: (rename-to wp_core_timeout_add)
* @self: the core
* @source: (out) (optional): the source
* @timeout_ms: the timeout in milliseconds
* @closure: the closure to invoke
*
* Adds a timeout callback to be called at regular intervals in the same
* #GMainContext as the one used by this core.
*
* This is the same as wp_core_timeout_add(), but it allows you to specify
* a #GClosure instead of a C callback.
*/
void
wp_core_timeout_add_closure
(
WpCore
*
self
,
GSource
**
source
,
guint
timeout_ms
,
GClosure
*
closure
)
{
g_autoptr
(
GSource
)
s
=
NULL
;
g_return_if_fail
(
WP_IS_CORE
(
self
));
g_return_if_fail
(
closure
!=
NULL
);
s
=
g_timeout_source_new
(
timeout_ms
);
g_source_set_closure
(
s
,
closure
);
g_source_attach
(
s
,
self
->
context
);
if
(
source
)
*
source
=
g_source_ref
(
s
);
}
/**
* wp_core_sync:
* @self: the core
...
...
This diff is collapsed.
Click to expand it.
lib/wp/core.h
+
9
−
1
View file @
a10ee91b
...
...
@@ -54,9 +54,17 @@ void wp_core_idle_add (WpCore * self, GSource **source, GSourceFunc function,
gpointer
data
,
GDestroyNotify
destroy
);
WP_API
void
wp_core_timeout_add
(
WpCore
*
self
,
GSource
**
source
,
guint64
timeout_ms
,
void
wp_core_idle_add_closure
(
WpCore
*
self
,
GSource
**
source
,
GClosure
*
closure
);
WP_API
void
wp_core_timeout_add
(
WpCore
*
self
,
GSource
**
source
,
guint
timeout_ms
,
GSourceFunc
function
,
gpointer
data
,
GDestroyNotify
destroy
);
WP_API
void
wp_core_timeout_add_closure
(
WpCore
*
self
,
GSource
**
source
,
guint
timeout_ms
,
GClosure
*
closure
);
WP_API
gboolean
wp_core_sync
(
WpCore
*
self
,
GCancellable
*
cancellable
,
GAsyncReadyCallback
callback
,
gpointer
user_data
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment