device filtering support

Michael Plante michael.plante at gmail.com
Sat Feb 4 16:28:36 EST 2012


Pete Batard wrote:
>> I'm both trying to optimize and avoid potentially disruptive traffic.

Please define disruptive.  If you just mean "excessive", then I would say
that's redundant (just optimization) and we should just go with threads.  If
you mean "it breaks things", then I'd say we need to rethink this whole
thing.  Did I miss a third potential meaning for "disruptive"?


>> Apps will just query that process, and the process will also occasionally
send a
>> message to apps that registered for hotplug, so, unless we do things
>> poorly, and especially as the whole point is not to generate bus traffic
>> except on hotplug, I don't exactly see how an app could cause that
>> process to crash by asking "Hey, can you give me some <cached> libusbx
>> data about device xyz?" or when receiving a ping about hotplug.
>>
>> Then again, I haven't looked that closely on how this whole process
>> should be implemented in practice, so there's the possibility it won't
>> be that simple.

Let's ignore for a moment that this is now highly platform-dependent (an
issue that could go away with [p]threads), and let's focus on Windows.
Presumably this data is passed around with shared memory?  Ok, you can make
it read-only.  Some sort of locking may still be required to prevent the
data from being updated while the client process is still reading it, and
then that client process may hold that lock longer than it should.  I'll
grant this is not as bad as I made it sound, but it is still an annoyance
that will lead to the libusbx process living longer than it should for what
appears to the user to be no obvious reason, giving libusbx a bad name, at
least to anyone who knows just enough to open task manager.

There are probably other things I won't even think of until I see an
implementation, and that assumes I even have time to look at the
implementation.

I still would prefer a threaded implementation.  It's cleaner.  And, as
mentioned, far easier to make platform-independent.  And keep in mind, in
summary, my point about the fact that if it breaks with threads, it will
break anyway because someone else somewhere will have a second process even
if we don't.


>> But is it nightmarishly complex?

I exaggerated slightly, but my position stands.


Regards,
Michael




More information about the libusbx mailing list