Re: how many thread process used by rygel



Dear Jens,

the code(in c language) below that I modified:
It can not work for render function, could you give me some hint about
reduce the threads when rygel is running?
========================================================
static gint rygel_main_main (gchar** args, int args_length1) {
	gint result = 0;
	RygelMain* main;
	RygelDBusService* service;
	gchar** _tmp0_;
	gint _tmp0__length1;
	gchar** _tmp1_;
	gint _tmp1__length1;
	gchar** original_args;
	gint original_args_length1;
	gint _original_args_size_;
	RygelMain* _tmp8_;
	gint _tmp9_ = 0;
	gint exit_code;
	RygelDBusService* _tmp10_;
	RygelMain* _tmp12_;
	gboolean _tmp13_;
	GError * _inner_error_ = NULL;
	main = NULL;
	service = NULL;
	_tmp0_ = args;
	_tmp0__length1 = args_length1;
	_tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup1 (_tmp0_, _tmp0__length1)
: ((gpointer) _tmp0_);
	_tmp1__length1 = _tmp0__length1;
	original_args = _tmp1_;
	original_args_length1 = _tmp1__length1;
	_original_args_size_ = original_args_length1;
	setlocale (LC_ALL, "");
	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);
	{
		RygelMain* _tmp2_;
		RygelMain* _tmp3_;
		RygelMain* _tmp4_;
		RygelDBusService* _tmp5_;
		RygelDBusService* _tmp6_;
		rygel_cmdline_config_parse_args (&args, &args_length1, &_inner_error_);
		if (_inner_error_ != NULL) {
			if (g_error_matches (_inner_error_, RYGEL_CMDLINE_CONFIG_ERROR,
RYGEL_CMDLINE_CONFIG_ERROR_VERSION_ONLY)) {
				goto __catch104_rygel_cmdline_config_error_version_only;
			}
			goto __catch104_g_error;
		}
		_tmp2_ = rygel_main_new (&_inner_error_);
		_tmp3_ = _tmp2_;
		if (_inner_error_ != NULL) {
			if (g_error_matches (_inner_error_, RYGEL_CMDLINE_CONFIG_ERROR,
RYGEL_CMDLINE_CONFIG_ERROR_VERSION_ONLY)) {
				goto __catch104_rygel_cmdline_config_error_version_only;
			}
			goto __catch104_g_error;
		}
		_g_object_unref0 (main);
		main = _tmp3_;
		_tmp4_ = main;
#if 0		
		_tmp5_ = rygel_dbus_service_new (_tmp4_);
		_g_object_unref0 (service);
		service = _tmp5_;
		_tmp6_ = service;
		rygel_dbus_service_publish (_tmp6_);
#endif		
	}
	goto __finally104;
	__catch104_rygel_cmdline_config_error_version_only:
	{
		GError* err = NULL;
		err = _inner_error_;
		_inner_error_ = NULL;
		result = 0;
		_g_error_free0 (err);
		original_args = (_vala_array_free (original_args,
original_args_length1, (GDestroyNotify) g_free), NULL);
//		_g_object_unref0 (service);
		_g_object_unref0 (main);
		return result;
	}
	goto __finally104;
	__catch104_g_error:
	{
		GError* err = NULL;
		const gchar* _tmp7_;
		err = _inner_error_;
		_inner_error_ = NULL;
		_tmp7_ = err->message;
		g_error ("rygel-main.vala:259: %s", _tmp7_);
		_g_error_free0 (err);
	}
	__finally104:
	if (_inner_error_ != NULL) {
		original_args = (_vala_array_free (original_args,
original_args_length1, (GDestroyNotify) g_free), NULL);
//		_g_object_unref0 (service);
		_g_object_unref0 (main);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)",
__FILE__, __LINE__, _inner_error_->message, g_quark_to_string
(_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return 0;
	}
	_tmp8_ = main;
	_tmp9_ = rygel_main_run (_tmp8_);
	exit_code = _tmp9_;
	_tmp10_ = service;
	if (_tmp10_ != NULL) {
		RygelDBusService* _tmp11_;
		_tmp11_ = service;
		rygel_dbus_service_unpublish (_tmp11_);
	}
	_tmp12_ = main;
	_tmp13_ = _tmp12_->need_restart;
	if (_tmp13_) {
		gchar** _tmp14_;
		gint _tmp14__length1;
		const gchar* _tmp15_;
		gchar** _tmp16_;
		gint _tmp16__length1;
		_tmp14_ = original_args;
		_tmp14__length1 = original_args_length1;
		_tmp15_ = _tmp14_[0];
		_tmp16_ = original_args;
		_tmp16__length1 = original_args_length1;
		execvp (_tmp15_, _tmp16_);
	}
	result = exit_code;
	original_args = (_vala_array_free (original_args,
original_args_length1, (GDestroyNotify) g_free), NULL);
//	_g_object_unref0 (service);
	_g_object_unref0 (main);
	return result;
}

========================================================
2012/7/18 Jens Georg <mail jensge org>:
> On Mi, 2012-07-18 at 15:11 +0800, Soho Soho123 wrote:
>> Dear Jens,
>>
>> Can I disable "GLib DBus thread" ?
>> As my understanding, if RENDERER ONLY "DBus" is not necessary, right?
>
> Yes, but again, not without patching code:
>
> http://git.gnome.org/browse/rygel/tree/src/rygel/rygel-main.vala
>
> lines 265 and 266 are responsible for the DBus service. However, it
> might be that recent GLib always has this thread due to GApplication.
>
>>
>>
>> Thanks!
>>
>> Best Regards,
>> Soho
>> 2012/7/18 Jens Georg <mail jensge org>:
>> > On Di, 2012-07-17 at 22:01 +0800, Soho Soho123 wrote:
>> >> Dears,
>> >>
>> >> per observation from Rygel verification,
>> >> when I start rygel by "rygel -g 5&", there are 2 threads run on my
>> >> target platform.
>> >> when I play a MP3 from W7 media player, then there are 6 threads run
>> >> on my target platform.
>> >> when I stop playing MP3 from W7 media player, then there 2 threads run
>> >> on my target platform.
>> >>
>> >> Does anyone have idea about there 4 threads are started when rygel
>> >> playing audio ?
>> >> which gstreamer element start thread ?
>> >>
>> >> and another question,
>> >> I can see the main function of rygel,
>> >> rygel_main_run(), the function will call g_main_loop_run() to start loop.
>> >> why there are 2 threads stated in main function?
>> >
>> > Rygel itself only ever operates in a single (main) thread. However some
>> > of the libraries we use spawn threads on their own:
>> >
>> > GLib - One for GDBus; that's the two threads you see when Rygel is idle
>> > (main thread + GLib DBus thread)
>> >
>> > GStreamer - A lot while decoding and encoding
>> >
>> >
>>
>
>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]