Re: [PATCH BlueZ 1/9] gdbus: Remove connection from g_dbus_remove_watch

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

 



Hi Marcel,

On Sat, Oct 6, 2012 at 4:40 PM, Marcel Holtmann <marcel@xxxxxxxxxxxx> wrote:
> Hi Luiz,
>
>> The connection is not really needed since the list of listeners is
>> global not per connection, besides it is more convenient this way as
>> only the id is needed.
>
> they are not global, they are per connection. That we do not fully
> implement this correctly is another story. That should be fixed here.

Not sure if Im following you, the point here is that the caller only
need to store the id because the data that the id refer to already
store the connection as context. Btw let me paste what
g_dbus_remove_watch does:

	for (ldata = listeners; ldata; ldata = ldata->next) {
		data = ldata->data;

		cb = filter_data_find_callback(data, id);
		if (cb) {
			filter_data_remove_callback(data, cb);
			return TRUE;
		}
	}

So as per current implementation the listeners are global, you can
argue it is not very efficient and can cause extra iteration if there
are more connections but overall this seems to pay off to avoid having
the caller to manage connection. Btw this is the same approach glib
uses regarding io watches, they are global so you don't have to store
the GIOChannel together with the id to be able to remove them as the
g_source_remove only takes the id.

-- 
Luiz Augusto von Dentz
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux