DecoderControl, InputStream: use Mutex/Cond instead of GMutex/GCond

This commit is contained in:
Max Kellermann
2013-01-27 17:20:50 +01:00
parent 257a0dee75
commit 6f3d70b5e2
46 changed files with 182 additions and 234 deletions

View File

@@ -113,8 +113,8 @@ despotify_playlist_finish(void)
static struct playlist_provider *
despotify_playlist_open_uri(const char *url, G_GNUC_UNUSED GMutex *mutex,
G_GNUC_UNUSED GCond *cond)
despotify_playlist_open_uri(const char *url,
gcc_unused Mutex &mutex, gcc_unused Cond &cond)
{
struct despotify_playlist *ctx;
struct despotify_session *session;

View File

@@ -85,8 +85,8 @@ static const struct tag_handler embcue_tag_handler = {
static struct playlist_provider *
embcue_playlist_open_uri(const char *uri,
G_GNUC_UNUSED GMutex *mutex,
G_GNUC_UNUSED GCond *cond)
gcc_unused Mutex &mutex,
gcc_unused Cond &cond)
{
if (!g_path_is_absolute(uri))
/* only local files supported */

View File

@@ -79,7 +79,7 @@ lastfm_finish(void)
* @return data fetched, or NULL on error. Must be freed with g_free.
*/
static char *
lastfm_get(const char *url, GMutex *mutex, GCond *cond)
lastfm_get(const char *url, Mutex &mutex, Cond &cond)
{
struct input_stream *input_stream;
GError *error = NULL;
@@ -96,7 +96,7 @@ lastfm_get(const char *url, GMutex *mutex, GCond *cond)
return NULL;
}
g_mutex_lock(mutex);
mutex.lock();
input_stream_wait_ready(input_stream);
@@ -113,7 +113,7 @@ lastfm_get(const char *url, GMutex *mutex, GCond *cond)
break;
/* I/O error */
g_mutex_unlock(mutex);
mutex.unlock();
input_stream_close(input_stream);
return NULL;
}
@@ -121,7 +121,7 @@ lastfm_get(const char *url, GMutex *mutex, GCond *cond)
length += nbytes;
} while (length < sizeof(buffer));
g_mutex_unlock(mutex);
mutex.unlock();
input_stream_close(input_stream);
return g_strndup(buffer, length);
@@ -154,7 +154,7 @@ lastfm_find(const char *response, const char *name)
}
static struct playlist_provider *
lastfm_open_uri(const char *uri, GMutex *mutex, GCond *cond)
lastfm_open_uri(const char *uri, Mutex &mutex, Cond &cond)
{
struct lastfm_playlist *playlist;
GError *error = NULL;
@@ -235,7 +235,7 @@ lastfm_open_uri(const char *uri, GMutex *mutex, GCond *cond)
return NULL;
}
g_mutex_lock(mutex);
mutex.lock();
input_stream_wait_ready(playlist->is);
@@ -243,7 +243,7 @@ lastfm_open_uri(const char *uri, GMutex *mutex, GCond *cond)
:-( */
input_stream_override_mime_type(playlist->is, "application/xspf+xml");
g_mutex_unlock(mutex);
mutex.unlock();
/* parse the XSPF playlist */

View File

@@ -247,7 +247,8 @@ static yajl_callbacks parse_callbacks = {
* @return -1 on error, 0 on success.
*/
static int
soundcloud_parse_json(const char *url, yajl_handle hand, GMutex* mutex, GCond* cond)
soundcloud_parse_json(const char *url, yajl_handle hand,
Mutex &mutex, Cond &cond)
{
struct input_stream *input_stream;
GError *error = NULL;
@@ -264,7 +265,7 @@ soundcloud_parse_json(const char *url, yajl_handle hand, GMutex* mutex, GCond* c
return -1;
}
g_mutex_lock(mutex);
mutex.lock();
input_stream_wait_ready(input_stream);
yajl_status stat;
@@ -280,7 +281,7 @@ soundcloud_parse_json(const char *url, yajl_handle hand, GMutex* mutex, GCond* c
if (input_stream_eof(input_stream)) {
done = true;
} else {
g_mutex_unlock(mutex);
mutex.unlock();
input_stream_close(input_stream);
return -1;
}
@@ -308,7 +309,7 @@ soundcloud_parse_json(const char *url, yajl_handle hand, GMutex* mutex, GCond* c
}
}
g_mutex_unlock(mutex);
mutex.unlock();
input_stream_close(input_stream);
return 0;
@@ -323,7 +324,7 @@ soundcloud_parse_json(const char *url, yajl_handle hand, GMutex* mutex, GCond* c
*/
static struct playlist_provider *
soundcloud_open_uri(const char *uri, GMutex *mutex, GCond *cond)
soundcloud_open_uri(const char *uri, Mutex &mutex, Cond &cond)
{
struct soundcloud_playlist *playlist = NULL;