Skip to content

Commit

Permalink
replace g_thread_create with g_thread_new
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Matthew committed Jul 21, 2012
1 parent 30fde08 commit 3f1cf05
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 44 deletions.
2 changes: 1 addition & 1 deletion lib/rb-file-helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ rb_uri_handle_recursively_async (const char *uri,
data->func = func;
data->user_data = user_data;

g_thread_create ((GThreadFunc)_recurse_async_func, data, FALSE, NULL);
g_thread_new ("rb-uri-recurse", (GThreadFunc)_recurse_async_func, data);
}

/**
Expand Down
5 changes: 1 addition & 4 deletions lib/rb-thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,16 +280,13 @@ rb_thread_constructor (GType type, guint n_construct_properties,
RBThread *thread;
RBThreadClass *klass;
GObjectClass *parent_class;
GError *error = NULL;

klass = RB_THREAD_CLASS (g_type_class_peek (RB_TYPE_THREAD));

parent_class = G_OBJECT_CLASS (g_type_class_peek_parent (klass));
thread = RB_THREAD (parent_class->constructor (type, n_construct_properties,
construct_properties));
thread->priv->thread = g_thread_create (rb_thread_action_thread_main, thread, TRUE, &error);
if (!thread->priv->thread)
g_error ("Couldn't create thread: %s", error->message);
thread->priv->thread = g_thread_new ("rb-thread", rb_thread_action_thread_main, thread);

/* Wait until the thread's mainloop is running */
g_mutex_lock (thread->priv->state_mutex);
Expand Down
3 changes: 1 addition & 2 deletions plugins/audiocd/rb-audiocd-source.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,7 @@ rb_audiocd_source_constructed (GObject *object)
gtk_widget_show_all (grid);
gtk_container_add (GTK_CONTAINER (source), grid);

g_thread_create ((GThreadFunc)rb_audiocd_load_songs, g_object_ref (source), FALSE, NULL);

g_thread_new ("audiocd-scan", (GThreadFunc)rb_audiocd_load_songs, g_object_ref (source));
g_object_unref (db);
g_object_unref (shell_player);
}
Expand Down
13 changes: 1 addition & 12 deletions plugins/audiocd/sj-metadata-getter.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,18 +243,7 @@ lookup_cd (SjMetadataGetter *mdg)
gboolean
sj_metadata_getter_list_albums (SjMetadataGetter *mdg, GError **error)
{
GThread *thread;

g_object_ref (mdg);
thread = g_thread_create ((GThreadFunc)lookup_cd, mdg, TRUE, error);
if (thread == NULL) {
g_set_error (error,
SJ_ERROR, SJ_ERROR_INTERNAL_ERROR,
_("Could not create CD lookup thread"));
g_object_unref (mdg);
return FALSE;
}

g_thread_new ("sj-cd-lookup", (GThreadFunc)lookup_cd, g_object_ref (mdg));
return TRUE;
}

Expand Down
5 changes: 3 additions & 2 deletions plugins/ipod/rb-ipod-db.c
Original file line number Diff line number Diff line change
Expand Up @@ -886,8 +886,9 @@ save_timeout_cb (RbIpodDb *ipod_db)
rb_debug ("Switching iPod database to read-only");
priv->read_only = TRUE;

priv->saving_thread = g_thread_create ((GThreadFunc)saving_thread,
ipod_db, TRUE, NULL);
priv->saving_thread = g_thread_new ("ipod-db-save",
(GThreadFunc)saving_thread,
ipod_db);
priv->save_timeout_id = 0;
return FALSE;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/ipod/rb-ipod-source.c
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,7 @@ impl_delete_entries (RBMediaPlayerSource *source, GList *entries, RBMediaPlayerS
data->destroy_data = destroy_data;
data->files = filenames;

g_thread_create ((GThreadFunc) delete_thread, data, FALSE, NULL);
g_thread_new ("ipod-delete", (GThreadFunc) delete_thread, data);
}

static RBTrackTransferBatch *
Expand Down
2 changes: 1 addition & 1 deletion plugins/mtpdevice/rb-mtp-thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ rb_mtp_thread_init (RBMtpThread *thread)

thread->albums = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, (GDestroyNotify) LIBMTP_destroy_album_t);

thread->thread = g_thread_create ((GThreadFunc) task_thread, thread, TRUE, NULL); /* XXX should handle errors i guess */
thread->thread = g_thread_new ("mtp", (GThreadFunc) task_thread, thread);
}

static void
Expand Down
8 changes: 1 addition & 7 deletions podcast/rb-podcast-add-dialog.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,6 @@ static void
parse_in_thread (RBPodcastAddDialog *dialog, const char *text, gboolean existing, gboolean single)
{
ParseThreadData *data;
GError *error = NULL;

data = g_new0 (ParseThreadData, 1);
data->dialog = g_object_ref (dialog);
Expand All @@ -370,12 +369,7 @@ parse_in_thread (RBPodcastAddDialog *dialog, const char *text, gboolean existing
data->existing = existing;
data->single = single;

g_thread_create ((GThreadFunc) parse_thread, data, TRUE, &error);
if (error != NULL) {
/* ugh.. */
g_warning ("Unable to create podcast parsing thread: %s", error->message);
g_clear_error (&error);
}
g_thread_new ("podcast parser", (GThreadFunc) parse_thread, data);
}

static void
Expand Down
16 changes: 6 additions & 10 deletions podcast/rb-podcast-manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -977,14 +977,9 @@ download_podcast (GFileInfo *src_info, RBPodcastManagerInfo *data)
GDK_THREADS_LEAVE ();

data->cancel = g_cancellable_new ();
data->thread = g_thread_create ((GThreadFunc) podcast_download_thread,
data,
TRUE,
&error);
if (error != NULL) {
download_error (data, error);
g_error_free (error);
}
data->thread = g_thread_new ("podcast-download",
(GThreadFunc) podcast_download_thread,
data);
}

static void
Expand Down Expand Up @@ -1054,8 +1049,9 @@ rb_podcast_manager_subscribe_feed (RBPodcastManager *pd, const char *url, gboole
info->automatic = automatic;
info->existing_feed = existing_feed;

g_thread_create ((GThreadFunc) rb_podcast_manager_thread_parse_feed,
info, FALSE, NULL);
g_thread_new ("podcast-parse",
(GThreadFunc) rb_podcast_manager_thread_parse_feed,
info);

return TRUE;
}
Expand Down
2 changes: 1 addition & 1 deletion rhythmdb/rhythmdb-monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ _monitor_entry_thread (RhythmDB *db)
void
rhythmdb_start_monitoring (RhythmDB *db)
{
g_thread_create ((GThreadFunc)_monitor_entry_thread, g_object_ref (db), FALSE, NULL);
g_thread_new ("monitor-entry", (GThreadFunc)_monitor_entry_thread, g_object_ref (db));

/* monitor all library locations */
if (db->priv->library_locations) {
Expand Down
2 changes: 1 addition & 1 deletion rhythmdb/rhythmdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ rhythmdb_thread_create (RhythmDB *db,
if (pool)
g_thread_pool_push (pool, data, NULL);
else
g_thread_create ((GThreadFunc) func, data, FALSE, NULL);
g_thread_new ("rhythmdb-thread", (GThreadFunc) func, data);
}

static gboolean
Expand Down
2 changes: 1 addition & 1 deletion shell/rb-playlist-manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ rb_playlist_manager_save_playlists (RBPlaylistManager *mgr, gboolean force)
if (force)
rb_playlist_manager_save_data (data);
else
g_thread_create ((GThreadFunc) rb_playlist_manager_save_data, data, FALSE, NULL);
g_thread_new ("playlist-save", (GThreadFunc) rb_playlist_manager_save_data, data);

return TRUE;
}
Expand Down
2 changes: 1 addition & 1 deletion shell/rb-shell-player.c
Original file line number Diff line number Diff line change
Expand Up @@ -1668,7 +1668,7 @@ rb_shell_player_open_location (RBShellPlayer *player,
}
data->cancellable = g_object_ref (player->priv->parser_cancellable);

g_thread_create ((GThreadFunc)open_location_thread, data, FALSE, NULL);
g_thread_new ("open-location", (GThreadFunc)open_location_thread, data);
} else {
if (player->priv->parser_cancellable != NULL) {
g_object_unref (player->priv->parser_cancellable);
Expand Down

0 comments on commit 3f1cf05

Please sign in to comment.