ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-DBus/DBus.pm
(Generate patch)

Comparing AnyEvent-DBus/DBus.pm (file contents):
Revision 1.6 by root, Mon Jun 21 19:43:42 2010 UTC vs.
Revision 1.7 by root, Mon Jun 21 19:59:28 2010 UTC

29hacking L<Net::DBus::Reactor> so that all dbus connections created after 29hacking L<Net::DBus::Reactor> so that all dbus connections created after
30loading this module will automatically be managed by this module. 30loading this module will automatically be managed by this module.
31 31
32Note that a) a lot inside Net::DBus is still blocking b) if you call a 32Note that a) a lot inside Net::DBus is still blocking b) if you call a
33method that blocks, you again block your process (basically anything 33method that blocks, you again block your process (basically anything
34but calls to the Net::DBus::Binding::Connection objects block, but 34but calls to the Net::DBus::Binding::Connection objects block, but see
35see Net::DBus::Annoation, specifically dbus_call_async) and c) this 35Net::DBus::Annoation, specifically dbus_call_async) c) the underlying
36libdbus is often blocking itself, even with infinite timeouts and d) this
36module only implements the minimum API required to make Net::DBus work - 37module only implements the minimum API required to make Net::DBus work -
37Net::DBus unfortunately has no nice hooking API. 38Net::DBus unfortunately has no nice hooking API.
38 39
39However, unlike L<Net::DBus::Reactor>, this module should be fully 40However, unlike L<Net::DBus::Reactor>, this module should be fully
40non-blocking as long as you only use non-blocking APIs (Net::DBus::Reactor 41non-blocking as long as you only use non-blocking APIs (Net::DBus::Reactor
41blocks on writes). It should also be faster, but Net::DBus is such a 42blocks on writes). It should also be faster, but Net::DBus is such a
42morass os unneeded method calls that speed won't matter much... 43morass so unneeded method calls that speed won't matter much...
43 44
44=head2 EXAMPLE 45=head2 EXAMPLE
45 46
46Here is a simple example. Both work with AnyEvent::DBus and do the same 47Here is a simple example. Both work with AnyEvent::DBus and do the same
47thing, but only the second is actually non-blocking. 48thing, but only the second is actually non-blocking.
164 $con->set_watch_callbacks (\&io_on, \&watch_off, \&io_toggle); 165 $con->set_watch_callbacks (\&io_on, \&watch_off, \&io_toggle);
165# if $con->can ("set_watch_callbacks"); 166# if $con->can ("set_watch_callbacks");
166 167
167 $con->set_timeout_callbacks (\&timeout_on, \&watch_off, \&timeout_toggle); 168 $con->set_timeout_callbacks (\&timeout_on, \&watch_off, \&timeout_toggle);
168# if $con->can ("set_timeout_callbacks"); 169# if $con->can ("set_timeout_callbacks");
170
171 $con->dispatch; # for good measure
169} 172}
170 173
171=head1 SEE ALSO 174=head1 SEE ALSO
172 175
173L<AnyEvent>, L<Net::DBus>. 176L<AnyEvent>, L<Net::DBus>.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines