… | |
… | |
1844 | |
1844 | |
1845 | myclass obj; |
1845 | myclass obj; |
1846 | ev::io iow; |
1846 | ev::io iow; |
1847 | iow.set <myclass, &myclass::io_cb> (&obj); |
1847 | iow.set <myclass, &myclass::io_cb> (&obj); |
1848 | |
1848 | |
1849 | =item w->set (void (*function)(watcher &w, int), void *data = 0) |
1849 | =item w->set<function> (void *data = 0) |
1850 | |
1850 | |
1851 | Also sets a callback, but uses a static method or plain function as |
1851 | Also sets a callback, but uses a static method or plain function as |
1852 | callback. The optional C<data> argument will be stored in the watcher's |
1852 | callback. The optional C<data> argument will be stored in the watcher's |
1853 | C<data> member and is free for you to use. |
1853 | C<data> member and is free for you to use. |
1854 | |
1854 | |
|
|
1855 | The prototype of the C<function> must be C<void (*)(ev::TYPE &w, int)>. |
|
|
1856 | |
1855 | See the method-C<set> above for more details. |
1857 | See the method-C<set> above for more details. |
|
|
1858 | |
|
|
1859 | Example: |
|
|
1860 | |
|
|
1861 | static void io_cb (ev::io &w, int revents) { } |
|
|
1862 | iow.set <io_cb> (); |
1856 | |
1863 | |
1857 | =item w->set (struct ev_loop *) |
1864 | =item w->set (struct ev_loop *) |
1858 | |
1865 | |
1859 | Associates a different C<struct ev_loop> with this watcher. You can only |
1866 | Associates a different C<struct ev_loop> with this watcher. You can only |
1860 | do this when the watcher is inactive (and not pending either). |
1867 | do this when the watcher is inactive (and not pending either). |