Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
f3ac8a7c
Commit
f3ac8a7c
authored
Aug 31, 2011
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
io_thread: allow _call() from inside the thread
parent
f3d95f70
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
+20
-0
io_thread.c
src/io_thread.c
+13
-0
io_thread.h
src/io_thread.h
+7
-0
No files found.
src/io_thread.c
View file @
f3ac8a7c
...
...
@@ -107,6 +107,12 @@ io_thread_context(void)
return
io
.
context
;
}
bool
io_thread_inside
(
void
)
{
return
io
.
thread
!=
NULL
&&
g_thread_self
()
==
io
.
thread
;
}
guint
io_thread_idle_add
(
GSourceFunc
function
,
gpointer
data
)
{
...
...
@@ -154,6 +160,13 @@ io_thread_call_func(gpointer _data)
gpointer
io_thread_call
(
GThreadFunc
function
,
gpointer
_data
)
{
assert
(
io
.
thread
!=
NULL
);
if
(
io_thread_inside
())
/* we're already in the I/O thread - no
synchronization needed */
return
function
(
_data
);
struct
call_data
data
=
{
.
function
=
function
,
.
data
=
_data
,
...
...
src/io_thread.h
View file @
f3ac8a7c
...
...
@@ -52,6 +52,13 @@ G_GNUC_PURE
GMainContext
*
io_thread_context
(
void
);
/**
* Is the current thread the I/O thread?
*/
G_GNUC_PURE
bool
io_thread_inside
(
void
);
guint
io_thread_idle_add
(
GSourceFunc
function
,
gpointer
data
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment