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
36b8968e
Commit
36b8968e
authored
Dec 28, 2008
by
Thomas Jansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output: migrate from pthread to glib threads
parent
28128dc4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
12 deletions
+9
-12
output_control.c
src/output_control.c
+2
-2
output_init.c
src/output_init.c
+1
-1
output_internal.h
src/output_internal.h
+2
-3
output_thread.c
src/output_thread.c
+4
-6
No files found.
src/output_control.c
View file @
36b8968e
...
@@ -77,7 +77,7 @@ audio_output_open(struct audio_output *audioOutput,
...
@@ -77,7 +77,7 @@ audio_output_open(struct audio_output *audioOutput,
audio_output_close
(
audioOutput
);
audio_output_close
(
audioOutput
);
}
}
if
(
audioOutput
->
thread
==
0
)
if
(
audioOutput
->
thread
==
NULL
)
audio_output_thread_start
(
audioOutput
);
audio_output_thread_start
(
audioOutput
);
if
(
!
audioOutput
->
open
)
if
(
!
audioOutput
->
open
)
...
@@ -135,7 +135,7 @@ void audio_output_close(struct audio_output *audioOutput)
...
@@ -135,7 +135,7 @@ void audio_output_close(struct audio_output *audioOutput)
void
audio_output_finish
(
struct
audio_output
*
audioOutput
)
void
audio_output_finish
(
struct
audio_output
*
audioOutput
)
{
{
audio_output_close
(
audioOutput
);
audio_output_close
(
audioOutput
);
if
(
audioOutput
->
thread
!=
0
)
if
(
audioOutput
->
thread
!=
NULL
)
ao_command
(
audioOutput
,
AO_COMMAND_KILL
);
ao_command
(
audioOutput
,
AO_COMMAND_KILL
);
if
(
audioOutput
->
plugin
->
finish
)
if
(
audioOutput
->
plugin
->
finish
)
audioOutput
->
plugin
->
finish
(
audioOutput
->
data
);
audioOutput
->
plugin
->
finish
(
audioOutput
->
data
);
...
...
src/output_init.c
View file @
36b8968e
...
@@ -102,7 +102,7 @@ int audio_output_init(struct audio_output *ao, ConfigParam * param)
...
@@ -102,7 +102,7 @@ int audio_output_init(struct audio_output *ao, ConfigParam * param)
}
else
}
else
audio_format_clear
(
&
ao
->
reqAudioFormat
);
audio_format_clear
(
&
ao
->
reqAudioFormat
);
ao
->
thread
=
0
;
ao
->
thread
=
NULL
;
notify_init
(
&
ao
->
notify
);
notify_init
(
&
ao
->
notify
);
ao
->
command
=
AO_COMMAND_NONE
;
ao
->
command
=
AO_COMMAND_NONE
;
...
...
src/output_internal.h
View file @
36b8968e
...
@@ -23,7 +23,6 @@
...
@@ -23,7 +23,6 @@
#include "pcm_utils.h"
#include "pcm_utils.h"
#include "notify.h"
#include "notify.h"
#include <pthread.h>
#include <time.h>
#include <time.h>
struct
audio_output
{
struct
audio_output
{
...
@@ -84,10 +83,10 @@ struct audio_output {
...
@@ -84,10 +83,10 @@ struct audio_output {
size_t
convBufferLen
;
size_t
convBufferLen
;
/**
/**
* The thread handle, or
"0"
if the output thread isn't
* The thread handle, or
NULL
if the output thread isn't
* running.
* running.
*/
*/
pthread_t
thread
;
GThread
*
thread
;
/**
/**
* Notify object for the thread.
* Notify object for the thread.
...
...
src/output_thread.c
View file @
36b8968e
...
@@ -106,7 +106,7 @@ static void ao_pause(struct audio_output *ao)
...
@@ -106,7 +106,7 @@ static void ao_pause(struct audio_output *ao)
}
}
}
}
static
void
*
audio_output_task
(
void
*
arg
)
static
gpointer
audio_output_task
(
gpointer
arg
)
{
{
struct
audio_output
*
ao
=
arg
;
struct
audio_output
*
ao
=
arg
;
bool
ret
;
bool
ret
;
...
@@ -167,12 +167,10 @@ static void *audio_output_task(void *arg)
...
@@ -167,12 +167,10 @@ static void *audio_output_task(void *arg)
void
audio_output_thread_start
(
struct
audio_output
*
ao
)
void
audio_output_thread_start
(
struct
audio_output
*
ao
)
{
{
pthread_attr_t
attr
;
GError
*
e
;
assert
(
ao
->
command
==
AO_COMMAND_NONE
);
assert
(
ao
->
command
==
AO_COMMAND_NONE
);
pthread_attr_init
(
&
attr
);
if
(
!
(
ao
->
thread
=
g_thread_create
(
audio_output_task
,
ao
,
FALSE
,
&
e
)))
pthread_attr_setdetachstate
(
&
attr
,
PTHREAD_CREATE_DETACHED
);
g_error
(
"Failed to spawn output task: %s
\n
"
,
e
->
message
);
if
(
pthread_create
(
&
ao
->
thread
,
&
attr
,
audio_output_task
,
ao
))
g_error
(
"Failed to spawn output task: %s
\n
"
,
strerror
(
errno
));
}
}
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