summaryrefslogtreecommitdiff
path: root/ev.pod
diff options
context:
space:
mode:
authorroot <root>2008-12-03 15:23:44 +0000
committerroot <root>2008-12-03 15:23:44 +0000
commitc80a9f5d507071c8ca31b8134f2a1662f306ef28 (patch)
treeaaf034c7a4d424efb43057688289ad46418ca350 /ev.pod
parent0b28ac4571929a861fbacc5ce9c61de21395debd (diff)
*** empty log message ***
Diffstat (limited to 'ev.pod')
-rw-r--r--ev.pod30
1 files changed, 30 insertions, 0 deletions
diff --git a/ev.pod b/ev.pod
index 23942c0..a6f6854 100644
--- a/ev.pod
+++ b/ev.pod
@@ -2893,6 +2893,36 @@ Example: simple class declaration and watcher initialisation
ev::io iow;
iow.set <myclass, &myclass::io_cb> (&obj);
+=item w->set (object *)
+
+This is an B<experimental> feature that might go away in a future version.
+
+This is a variation of a method callback - leaving out the method to call
+will default the method to C<operator ()>, which makes it possible to use
+functor objects without having to manually specify the C<operator ()> all
+the time. Incidentally, you can then also leave out the template argument
+list.
+
+The C<operator ()> method prototype must be C<void operator ()(watcher &w,
+int revents)>.
+
+See the method-C<set> above for more details.
+
+Example: use a functor object as callback.
+
+ struct myfunctor
+ {
+ void operator() (ev::io &w, int revents)
+ {
+ ...
+ }
+ }
+
+ myfunctor f;
+
+ ev::io w;
+ w.set (&f);
+
=item w->set<function> (void *data = 0)
Also sets a callback, but uses a static method or plain function as