… | |
… | |
777 | |
777 | |
778 | Setting a priority outside the range of C<EV_MINPRI> to C<EV_MAXPRI> is |
778 | Setting a priority outside the range of C<EV_MINPRI> to C<EV_MAXPRI> is |
779 | fine, as long as you do not mind that the priority value you query might |
779 | fine, as long as you do not mind that the priority value you query might |
780 | or might not have been adjusted to be within valid range. |
780 | or might not have been adjusted to be within valid range. |
781 | |
781 | |
|
|
782 | =item ev_invoke (loop, ev_TYPE *watcher, int revents) |
|
|
783 | |
|
|
784 | Invoke the C<watcher> with the given C<loop> and C<revents>. Neither |
|
|
785 | C<loop> nor C<revents> need to be valid as long as the watcher callback |
|
|
786 | can deal with that fact. |
|
|
787 | |
|
|
788 | =item int ev_clear_pending (loop, ev_TYPE *watcher) |
|
|
789 | |
|
|
790 | If the watcher is pending, this function returns clears its pending status |
|
|
791 | and returns its C<revents> bitset (as if its callback was invoked). If the |
|
|
792 | watcher isn't pending it does nothing and returns C<0>. |
|
|
793 | |
782 | =back |
794 | =back |
783 | |
795 | |
784 | |
796 | |
785 | =head2 ASSOCIATING CUSTOM DATA WITH A WATCHER |
797 | =head2 ASSOCIATING CUSTOM DATA WITH A WATCHER |
786 | |
798 | |
… | |
… | |
1832 | |
1844 | |
1833 | myclass obj; |
1845 | myclass obj; |
1834 | ev::io iow; |
1846 | ev::io iow; |
1835 | iow.set <myclass, &myclass::io_cb> (&obj); |
1847 | iow.set <myclass, &myclass::io_cb> (&obj); |
1836 | |
1848 | |
1837 | =item w->set (void (*function)(watcher &w, int), void *data = 0) |
1849 | =item w->set<function> (void *data = 0) |
1838 | |
1850 | |
1839 | 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 |
1840 | 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 |
1841 | C<data> member and is free for you to use. |
1853 | C<data> member and is free for you to use. |
1842 | |
1854 | |
|
|
1855 | The prototype of the C<function> must be C<void (*)(ev::TYPE &w, int)>. |
|
|
1856 | |
1843 | 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> (); |
1844 | |
1863 | |
1845 | =item w->set (struct ev_loop *) |
1864 | =item w->set (struct ev_loop *) |
1846 | |
1865 | |
1847 | 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 |
1848 | do this when the watcher is inactive (and not pending either). |
1867 | do this when the watcher is inactive (and not pending either). |